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

Issue while invoking pega_rules_datetime.dateValue function

SA-1869

Summary



Developer has used following formula used to calculate a property within a Strategy:
@(Pega-RULES:DateTime).DateTimeDifference( @(Pega-RULES:DateTime).dateValue({DateTime property}), @(Pega-RULES:DateTime).dateValue({Property of type string or text}), "D")
When testing the component with autorun, developer was getting issues while invoking the function however the property was calculated correctly.
And, when trying to run NBAM Program, developer noticed an error message related the property calculated.

Error Messages



"Problem invoking function: pega_rules_datetime.dateValue--(String), null" when testing the strategy with data transform

Steps to Reproduce


Map the string property to datevalue function in the Strategy Set.
Autorun the Strategy Set to evaluate the expression containing the datevalue function.
Error occurs: Problem invoking function: pega_rules_datetime.dateValue--(String), null 

Root Cause



Issue while invoking function datevalue was due to text or string property mapped to dateValue function which does not have the proper datetime format.

User have to convert the string values of type ‘23-SEP-14' to proper date string values of the format '20140923T000000.000 GMT".
User should add the time portion by concatenating their property with "T000000.000 GMT" for example {String or Text property} + "T000000.000 GMT".
With this approach, user would be able to use the string or text property and will not get the error with the dateValue function
DateTime.parseDateString function can also be used to parse string value to datetime. This function return the number of milliseconds since January 1, 1970, 00:00:00 GMT represented by the string argument and it supports the following date/time patterns:
EEEE, MMMM d, yyyy h:mm:ss a z (datetime_full)- Thursday, January 17, 2008 3:18:10 PM IST
MMMM d, yyyy h:mm:ss a z (datetime_long) January 17, 2008 3:18:10 PM IST
MMM d, yyyy h:mm:ss a (datetime_medium) Jan 17, 2008 3:18:10 PM
M/d/yy h:mm a (datetime_short) 1/17/08 3:18 PM
MM/dd/yy kk:mm 01/17/08 15:18
MMM dd',' yyyy '-' HH:mm:ss z Jan 17, 2008 - 15:18:10 IST
yyyyMMdd'T'HHmmss 20080117T151810

Parameter:
strDate: a DateTime string to be parsed as a date
<b>Example:</b>
parseDateString("20090109T162504.370 GMT") = 1231518304370

Resolution



Updated the string or text property mapped to datevalue function to hold values of proper datetime format.

Published January 31, 2016 - Updated December 2, 2021

Was this useful?

100% 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