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
Have a question? Get answers now.
Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.