Question
To display date & time in EST time zone on UI as - 02-Mar-2018 07:53 AM
Hi Team,
Would you please assist on below and to achieve the functionality?
Getting date format as string from external system as - 2018-03-02 07:53:16. 000907 EST on service page and while storing it in new property in Pega in EST and we need to display on UI as 02-Mar-2018 07:53 AM in EST only.
Please note our server is in MST time zone.
I tried with FormatDateTime & addToDate function but was not able to achieve the requirement completely.
Please suggest on the same.
Kind Regards,
Raghav Jha
01-Mar-2018 07:53 AM
Hi Raghav,
You can try below approach for your requirement:
1. Convert '2018-03-02 07:53:16.000907' string to DateTime format in GMT using below api:
java.util.Date myDate = PRDateFormat.parse(locale, TimeZone, dateFormat, datestring)
eg: java.util.Date myDate = PRDateFormat.parse("", "EST", "yyyy-MM-dd hh:mm:ss", "2018-03-02 07:53:16");
Result: 20180302T125316.000 GMT - DateTime Property
2. Use 'FormatDateTime' function with the datetime property to get '02-Mar-2018 07:53 AM' format on UI.
Hope it helps.
Thanks.