Issue with Double Quotes in a Date Format

Situation:

You have an input date as "20190318" and you want to change the format of the date by using the date-format function in data mapper as date-format ($X-Path,"YYYYMMDD", "YYYY-MM-dd"). The result shown appears as "1970-01-01" instead of "2019-03-18".

Cause:

This issue occurs because of the use of double quotes (") while defining the arguments in the date-format() function. Whenever the arguments in a date-format() are defined in double quotes, it always gives default date value as "1970-01-01".

Solution:

Use single quotes (') while setting the arguments for input and output date format in the date-format() function. As it only supports arguments as a string.

date-format($X-Path,'YYYYMMDD', 'YYYY-MM-dd' ) 

where 'YYYYMMDD' is the input date format and 'YYYYMMDD' is the output date format.

 

Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.