Support Article
CurrentDate function is ignoring time zone
SA-381
Summary
Developer configures the CurrentDate function but the time is from a different time zone (e.g. 3 hours ahead) and the date format is different than that requested.
For example, if I utilize the following code in an activity Log-Message step:
"DATE: " + @(Pega-RULES:DateTime).CurrentDate("YYYYMMDD", "BRT")
The logfile result is:
2014-07-31 09:04:00,032 [fault (self-tuning)'] [ STANDARD] [ App1:01.02.96] (Activity_Work.Action) INFO 10.57.148.19|10.20.86.59 username1 - DATE: Jul 31, 2014 12:04:00 PM
How can we get the format desired in the the Brazilian time zone?
Error Messages
Not Applicable
Steps to Reproduce
Create a line in an activity and send the result to the log file:
This is the line : "DATA: " + @(Pega-RULES:DateTime).CurrentDate("YYYYMMDD", "BRT")
The log result is: 2014-07-31 09:04:00,032 [fault (self-tuning)'] [ STANDARD] ... - DATA: Jul 31, 2014 12:04:00 PM
Root Cause
The root cause of this problem is software use/operation error. The parameters to @CurrentDate were incorrect.
Resolution
The explanation for this behavior is as follows:
The date format parameter was invalid. The individual letters are case sensitive. If a letter is provided that is not valid, then the whole format string is ignored. The default format is used. The 'y' for year was not supplied and 'Y' was used in error. Same for 'd'. The returned time was in GMT and so was ahead by 3 hours, affecting dates during part of the day.
The signifier for the Brazil Eastern time zone was switched to "Brazil/East"
@FormatDateTime(@CurrentDateTime(), "yyyyMMdd", "Brazil/East", "")
Published March 12, 2016 - Updated October 8, 2020
Have a question? Get answers now.
Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.