[rt-users] How to change the display of Date Time Custom field in Email

Kevin Falcone falcone at bestpractical.com
Thu Feb 13 09:43:33 EST 2014


On Wed, Feb 12, 2014 at 10:54:17AM -0800, j.hubbard wrote:
> 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');}<br>

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.

https://github.com/bestpractical/rt/blob/stable/share/html/Elements/ShowCustomFieldDate#L49

$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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 235 bytes
Desc: not available
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20140213/61d0d6ad/attachment.sig>


More information about the rt-users mailing list