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)

Problem:

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.

Temporary Solution:

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.

Like (1)
1 user liked this.

Replies

May 11, 2014 - 1:50am

The work around of DSS setting reuquire the value to be  changed manually  on exact time of the day when day light saving mode changes to get the right result every time.

I would suggest to create a function that would evaluate if a specific timezone is in day light saving mode and then based on the function output  you can decide how many days to add .

 

May 28, 2014 - 3:00pm

Thanks Ashish_Anand I have created a RUF inDaylightTime to check if the given date is in Day light savings time or not.

 

November 27, 2014 - 2:39am

Is there any way to convert a date time in GMT format. ?

July 6, 2016 - 3:35pm

Use the function below.

 

@addTime(Param.TempDate, 0, @GetTimeZoneOffset(), 0, 0, false, "")

 

in this case you should not have problems with day light savings. 

 

 

August 16, 2016 - 2:03pm
Response to arunm462

Hi Arun, I am unable to find GetTimeZoneOffset() RUF. Is it a custom function? 

July 6, 2016 - 10:53pm

Great discussion all. In the future, I highly recommend posting similar questions in the new Product Support Community that just went live on the PDN today!

Thanks.

B.

Brendan | Community Moderator | Pegasystems Inc.

July 9, 2016 - 2:30pm

fyi - if OOTB property pyDisableTimezoneConversion is set to true in extension activity ApplicationProfileSetup the time zone will default to GMT.

December 12, 2017 - 10:12am
Response to sahup1

i think this is not used in pega 7.x versions 

March 27, 2017 - 1:24am

How does GetTimeZoneOffset() function works?

Related Posts