@DateTimeDifference Problem

Looking to find the number of days difference between two date fields.
Comparing @getCurrentDateStamp() and a property with type date. The precission is set to 'CYMD'. The Current date is 20091103, the compare property is 20091110 - the result is -2147483648.

Any ideas are appreciated.

**Moderation Team has archived post**

This post has been archived for educational purposes. Contents and links will no longer be updated. If you have the same/similar question, please write a new post.


Keep up to date on this post and subscribe to comments

November 3, 2009 - 1:24pm

I think the issue is this:

The function you are using expects two DateTime values, not Date values. You must append a time and zone to both before calling the function. You can append "T000000.000 GMT" to both strings to mean midnight.

See http://pdn.pega.com/ProductSupport/Products/PegaRULESProcessCommander/documents/PRPC/Help_V55/concepts/concepts2/conceptsdatetime.asp

November 3, 2009 - 2:40pm

I appended the time as suggested and got the same result.

November 3, 2009 - 3:42pm

Try using @differenceBetweenDays function which is under Pega-Rules, BusinessCalendar
(Note: If you don't want to use Business calendar for finding the difference b/w days pass parameter "useBusinessCalendar" as false)

November 3, 2009 - 3:47pm

Thank you for your input - it turns out, I needed to set the precision to 'D' instead of 'CYMD'. It is now working - I will remember @differenceBetweenDays for future reference.

March 8, 2016 - 12:36am

I try out @getCurrentDateStamp()   it's use (YYYYMMDD)  i need to get Only current year ( (YYYY)