Comparing two date values

I want to compare system/current date with user entered date. If anyone knows please reply with the code. Thanks in advance.

**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

February 14, 2012 - 4:02am


Use CompareDates() function
@CompareDates(Primary.pxUpdateDateTime, Primary.pxCreateDateTime, Primary.pyLabel) this will return the Boolean value True/False.

May 25, 2016 - 8:27am
Response to PRAVEENS@29

Hi, Praveen

What about comparing 2 Dates? In the Validation rule I can't find a function to compare 2 Dates, but only 2 DateTimes, as you said. The problem I have is that the properties I want to compare are Date type and this function CompareDates(DateTime, Datetime) will throw an error.  I want to create other properties with type DateTime and this will work, but sounds like a workaround. There has to be a comparer function also for Dates, right?  P.s. i'm using Pega 7.1.9

November 24, 2016 - 5:21am
Response to VasilicaN

Use another function @(Pega-Rules:Sort).defaultCompareDates(date1,date2)