Set Time Zone on Date Custom Field within Template

I’ve created a template to include a datetime custom field in my queue. I’m referencing it within my template with this assuming ‘Custom Date’ is the name of the datetime custom field:

{$Ticket->FirstCustomFieldValue( ‘Custom Date’ )}

The issue is that when this is sent out in email, it’s shown as UTC which I presume is how it’s stored in the database.

What code can I add to convert this to a different time zone?


After becoming more familiar with RT & Perl, I revisited this and figured it out.

The code above spits out the custom field datetime value in UTC. I have a template that displays all custom field values on a ticket in a correspondence email update. I was able to convert the custom field datetime value to the system’s local time as follows:

if ( $CustomField->Type eq ‘DateTime’ ) {
my $CFcontent = $CustomFieldValue->Content; #capture value of custom field date.
my $DateField = RT::Date->new($RT::SystemUser); #create date object in system user context.
$DateField->Set(Format=>‘ISO’, Value=>$CFcontent); #populate date object with value from CF.
$OUT .= $DateField->AsString; #append system datetime value of custom field to $OUT variable.

Now $OUT contains (in addition to other junk) the localized date time field of the custom field value instead of UTC. Hope this can help another newbie like me.