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

CurrentDate and ToDateTime functions do not work correctly



CurrentDate and ToDateTime functions are not working correctly in Java 1.7. The functions @(Pega-RULES:DateTime).CurrentDate("YYYYMMDD", pxRequestor.pyDefaultTimeZone), toDateTime(), and pxCreateDateTime Control return Null. This works in Java 1.6.

Error Messages String was not a datetime "20180907T081428"

Steps to Reproduce

Write an activity using the CurrentDate and ToDateTime Rule-Utility-Functions.

Root Cause

An issue in the custom application code or rules.

The use of 'YYYYMMDD' as a Date format is not supported. This stopped working with third-party Java update.


Perform either of the following local-changes:
  • Replace all occurrences of 'YYYYMMDD' with 'yyyyMMdd'
  • Create custom versions of CurrentDate and ToDateTime to scan for the incorrect format and replace with the correct format.

Published October 23, 2018 - 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