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

addToDate function returns results that are 1 year off



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.


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

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