Collaborate with developers, support engineers, and experts who build and work with Pega products. Join us to get fast answers to your questions, and participate in our Ask the Expert sessions!
Time Zone conversion problem (EST, EDT, GMT) in fetching data for reporting
In our application we are retrieving the resolved work for last 3 days and store in another table for reporting purpose. This is done by Agent on hourly basis.
We are in EDT time zone. As pega Date time processing happens in GMT standard. When we use addDays utility function to substract 3 days we are facing time zone issue.
@(Pega-RULES:BusinessCalendar).addDays(@(Pega-RULES:DateTime).CurrentDateTime(), -3, false, KPIReport)
Scenario 1 : At 07:50PM
Lets assume Current Date time as May 9th 07:50 PM in EDT the GMT time stamp will be 20140509T235000.000 GMT
So Pega addDays will return me 20140506T040000.000 GMT
Scenario 2 : At 08:10PM
Lets assume Current as May 9th 08:10 PM in EDT the GMT time stamp will be 20140510T001000.000 GMT
So Pega addDays will return me 20140507T040000.000 GMT instead of 20140506T040000.000
So Instead of fetching 3 days results now 2 days results are fetched.
As we are currently in EDT and the difference between EDT and GMT time zones is 4 hours.
So we are first substracting 4 hours using addTime() function and then doing addDays function.
@(Pega-RULES:BusinessCalendar).addTime(@(Pega-RULES:DateTime).CurrentDateTime(), 0, -4, 0, 0, false, KPIReport)
@(Pega-RULES:BusinessCalendar).addDays(Param.CurrentTimestampGMTM4, -3, false, KPIReport)
But After November we will go back to EST from EDT so the time zones hour difference would be 5 hours instead of 4 hours.
One work around is using Dynamic system setting to set -4 or -5 in the addTime function.
But I want to check if there is any better approach.