Skip to main content

This content has been archived and is no longer being updated. Links may not function; however, this content may be relevant to outdated versions of the product.

Support Article

FormatDateTime function returns incorrect result

SA-34440

Summary



User is using FormatDateTime function to convert date format from GMT to SGD format.

This function is returning incorrect date when run this function by agent or an activty.
.

Error Messages



Incorrect Date Conversion happened


Steps to Reproduce



1) Write an activity to convert GMT time to SGD time format using FormatDateTime function. (print the output in PegaRULES log).
2) Call this activity using agent rule.
3) Run the activity manually.
4) Compare the results.

Note: Manual run provides expected output and agent run provides incorrect results.


Root Cause



User has given incorrect Date Format in the FormatDateTime function resulting in wrong values for some Dates during conversion.

Resolution



Here’s the explanation for the reported behavior:

The function allows only the below highlighted Date /DateTime formats only and they are case sensitive.

In this Case, user is giving it as YYYY-MM-dd which should be given only as yyyyMMdd.

FormatDateTime("20090109T162504.370 GMT", "MMMM dd,yyyy hh:mm:ss a", "America/New_York", "en_US") = "Jan 9, 2009 11:25:04 AM"

FormatDateTime("20090109T162504.370 GMT", HHmmss, "America/New_York", "en_US") = "112504"

FormatDateTime("20090109T162504.370 GMT", "yyyyMMdd", "America/New_York", "en_US") = "20090109"

Published March 17, 2017 - Updated October 8, 2020

Was this useful?

0% found this useful

Have a question? Get answers now.

Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.

Did you find this content helpful?

Want to help us improve this content?

We'd prefer it if you saw us at our best.

Pega Community has detected you are using a browser which may prevent you from experiencing the site as intended. To improve your experience, please update your browser.

Close Deprecation Notice
Contact us