How to change the display of Date Time Custom field in Email

Hi, I have searched around for a while now and cannot find an answer so far.

I have a DateTime Custom field called “Effective”. The value of this field
is sent out in emails on ticket creation.

So far I have changed settings in RT_SiteConfig for $DateTimeFormat and
$DateDayBeforeMonth but those don’t affect the output in emails at all.

The output I see looks like ‘yyyy-mm-dd hr:min:sec’. I want it in
‘mm-dd-yyy hr:min:sec’.

Below is my template followed by an example email I receive. Any help on
how to get the template to change the way the date is sent in email would be
very much appreciated. Everything else in the template is working as
needed.

Thank you

–begin template–

Content-Type: text/html
s/[Comment]\s*//g; $s =~ s/^Re:\s*//i; $s;} Alert -
{$Ticket->FirstCustomFieldValue(‘Site’);}
RT-Attach-Message: yes

New Termination Notification.



{$Transaction->Content() eq ‘This transaction appears to have no content’ ?
‘’ :
$Transaction->Content();
}

Employee:      {$Ticket->FirstCustomFieldValue(‘Employee’);}

Effective:       {$Ticket->FirstCustomFieldValue(‘Effective’);}

Term
Type:
       {$Ticket->FirstCustomFieldValue(‘Term
Type’);}

Role:              {$Ticket->FirstCustomFieldValue(‘Role’);}

Role Detail:   {$Ticket->FirstCustomFieldValue(‘Role
Detail’);}

Site:                {$Ticket->FirstCustomFieldValue(‘Site’);}

Requestors:    {$Ticket->RequestorAddresses}

Ticket:           
{RT->Config->Get(‘WebURL’)}Ticket/Display.html?id={$Ticket->id}



–end template–

–begin email example–

New Termination Notification.

testing 123
Employee: Joe Somebody
Effective: 2014-02-19 15:35:00
Term Type: Type 1
Role: Other
Role Detail: Test
Site: New Mexico
Requestors: someone@example.com
Ticket: http://test-rt.company.local/Ticket/Display.html?id=9733

–end email example–

View this message in context: http://requesttracker.8502.n7.nabble.com/How-to-change-the-display-of-Date-Time-Custom-field-in-Email-tp56622.html

I have a DateTime Custom field called “Effective”. The value of this field
is sent out in emails on ticket creation.

So far I have changed settings in RT_SiteConfig for $DateTimeFormat and
$DateDayBeforeMonth but those don’t affect the output in emails at all.

Those change RT’s display of dates. They’re not going to change
custom code that you write.

Effective:       {$Ticket->FirstCustomFieldValue(‘Effective’);}

FirstCustomFieldValue returns the raw value of the custom field.
If you want it formatted, you need to use RT::Date.

Here is how the web frontend does it.

$Object->Content is basically the same for you as what you get back
from FirstCustomFieldValue.

Read about RT::Date here

http://bestpractical.com/docs/rt/latest/RT/Date.html

You’re probably most concerned with the Output formatters so you
either override or use the one you specified in the config.

-kevin