Click HERE to see how Saviynt Intelligence is transforming the industry. |
04/12/2022 12:54 PM
What config value do I use to insert my local time in an email template?
When I send out an email, I want to display in the email body, the date and time that the email was fired.
And I want that time to be in my local time, not UTC.
I tried using the following code but it returns the UTC not local time.
${new Date().format('MM-dd-yyyy hh:mm a',TimeZone.getTimeZone(' EST5EDT'))}
Solved! Go to Solution.
04/12/2022 01:48 PM
Hi Anand,
As i understand from the query, the requirement is to insert the time the email was triggered and the time should be the servers time zone from which the email trigger was originated.
Thanks
Ajay
04/12/2022 01:48 PM
Hi Anand,
I had to used a different from UTC as well in a different context (importing users from a connected app), and I came up with this sample code to get the Pacific time zone (which I updated to have same format as yours).
${(new Date()).format("MM-dd-yyyy hh:mm a",TimeZone.getTimeZone("PST"))}
I configured an email template locally and I got the below result :
Besides, I do see a space character before 'EST5EDT' which might cause an issue with your code.Please find below a list of all available TimeZones :
https://garygregory.wordpress.com/2013/06/18/what-are-the-java-timezone-ids/
Regards,
Adrien.