Both date and Datetime values are coming in same datetime property unable to compare with date property

Hi

We have done migration from pega6 to pega8,we have a property called LookBackDate which is DateTime property in pega 8.

But data which is migrated from pega 6 has date value. So the property contains both date values and datetime values in LookBackBack property.

We have a validation in that we have used function to compare LookBackDate with another date property.

@defaultCompareDates(.DOSFromDate,@FormatDateTime(pyWorkCover.LookBackDate,“yyyyMMdd”,“”, “”))<0 if it true error will be shown we kept this expression in when rule

vSo values coming in date time works fine, but if value comes in date format this expression not validating.

Can any one help to validate both scenarios in same expression or how to achieve this.

Thanks,

Ajay

@AJAYR16863281

Can you try using boolean CompareDates(String strDate1,String strDate2). Its supposed to compare date against datetime.

@SohamM95

Compare dates is working when LookBackDate comes in date format

But when comes in DateTime it is not working correctly.

@AJAYR16863281

Can you add a string on a when condition before the evaluation where you add 000000.000 GMT after the date only value when there’s no time present. Then use CompareDates to compare those.

@SohamM95

I used this function its working as expected.

@defaultCompareDates(.DOSFromDate,@FormatDateTime(@toDateTime(pyWorkCover.LookBackDate),“yyyyMMdd”,null,“”))<0

So both date and datetime format will accept

Thanks