Support Article
addToDate function returns results that are 1 year off
SA-88323
Summary
In an activity, the date displays incorrectly when the parameter is set as below,
@FormatDateTime(@addToDate("20190831T082222.067 GMT",120,0,0,0),YYYYMMdd,"America/Los_Angeles","en_US").
For example, the date displays as 20201229 instead of 20191229.
Error Messages
Not Applicable
Steps to Reproduce
Write an activity that sets a parameter as below,
@FormatDateTime(@addToDate("20190831T082222.067 GMT",120,0,0,0),YYYYMMdd,"America/Los_Angeles","en_US")
Root Cause
An issue in the custom application code or rules.
In the user's 'ReadCDSContractData' activity, the @FormatDateTime function is invoked and the 'YYYYMMdd' format is passed. The format passed is incorrect. The format must be, 'yyyyMMdd'.
According to the Oracle Java 6 documentation, 'y' (not 'Y') is for year.
Resolution
Perform the following local-change:
Change the YYYYMMdd format to the yyyyMMdd format in the user's ReadCDSContractData activity when invoking the @FormatDateTime function.
Published October 22, 2019 - 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.