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

String to Date conversion not working as expected

SA-34221

Summary



User have a requirement to format the date to YYYY-MM-DD.

When user is using the @String.todate() function to convert string to date they are getting default value for a date type property.

For example, the value of the date type property should be like 2016-01-01 but its appearing as 19700101.


Error Messages



Not Applicable

Steps to Reproduce



1.Convert a date to yyyy-MM-dd format using formatDateTime() function.
2.Convert the output string to date using @String.toDate() function.

Root Cause



Not Applicable

Resolution



Here’s the explanation for the reported behavior:

It is not possible to store the time in different formats.

Note that Date objects have no format.

To get a formatted string with "-", One has to convert to String.

Published March 13, 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