Question

differenceBetweenDates - date format between 7.2 and 7.4

Hello! We are upgrading from Pega 7.2 to 7.4. We use the OOB differenceBetweenDates in several spots in our existing applications. We are often using currentDate() function to get the current date as one parameter for the differenceBetweenDates function. We find this now errs because currentDate("","") returns the format YYYYNovDD, where Nov = November, or whatever month it currently is. And differenceBetweenDates no longer allows this format.

One solution is to use getCurrentDateStamp() as that returns the format YYYYMMDD which works with differenceBetweenDates. Alternatively we change what parameters we are sending currentDate().

The downside is we have to make this change in many spots in the system. It is possible some day this could break again for the format accepted by differenceBetweenDates changes again.

We could instead customize differenceBetweenDates to allow the format we want. Then we only need one code change instead of many. The downside is that it is customization of OOB code, which we are trying to do less of.

Does anyone have any insight into the reason the formatting required by differenceBetweenDates changed between 7.2 and 7.4? I have seen at least one community post where a similar thing happened with the same function at some point between v6.2 and v7.1.6, though we did not experience any problem back then.

Thanks for any thoughts!

***Edited by Moderator Marissa to update platform capability tags****

Comments

Keep up to date on this post and subscribe to comments

Pega
December 20, 2018 - 10:42am

I've looked through the code in both the 7.2 and the 7.4 release.  Other than the fact that this RUF was deprecated even back in 7.2 (the advice is to use "differenceBetweenDays", but the RUF in both releases just takes the parameters and passes them to this "betweenDays" RUF), there is no change in the code for either.

What is the error that you get, and can you show the stack trace that accompanies the error?  It sounds to me as if this might be a bug, since YYYYMMMDD is a valid date format

Pega
December 20, 2018 - 11:15pm

Hi Dayton,

You can use OOTB "difference between days" to calculate the same.It will work fine.