Integer to Date

Hello,

we are receiving date properties as integer types (YYYYMMDD). August 30, 2024 = 20240830

I am having trouble converting the int to a date type so we can do calculations with date/ dateTime types (difference between dates, etc). I have tried using @dateValue and @date but since these return bigDecimals they cause errors in the calculations.

Has anyone used a different function?

Thank you!

@DaniV17021618

Pega ideally stores date-only properties as integers. So an integer property can be used for calculations against date-only fields.

@SohamM95

Thank you for your reply! Does this mean calculations between integers and DateTimes are not possible?

I am trying to find how many days ago a payment was made. I’m not sure why I would get two different results or what they represent.

Ex:

@today() - .paymentDate = 19965 or -20220864

where .paymentDate = 20240829

@DaniV17021618 I think you can use the following functions @DateTimeDifference(@addToDate(Param.PaymentDate,0,0,0,0),@CurrentDateTime(),“D”)

@RoseV

Thank you for your reply! I tried that out and it works on my side.