Current date and given date-compare

Hi
I have a date in the form of String example str=2019-12-07
I need to check whether current date is ahead of given date

1 Like

if
cdate(strDate)>now
Then → Ahead

dateCompare.xaml (5.6 KB)

Thanks!

1 Like

Hi
use a IF condition like this
Datetime.Now > Datetime.ParseExact(“2019-12-07”,“yyyy-MM-dd”,System.Globalization.CultureInfo.InvariantCulture)

if true it will go to THEN part or goes to ELSE part
Cheers @KarthikBallary

1 Like

Hi

but if given date is equal to current date it is showing current date is ahead of given date

It think current date is considering time also. How to ignore time?

1 Like

try like this,

cdate(strDate).Date>now.Date

Thanks!

Then the expression be like this
Datetime.Now.Date > Datetime.ParseExact(“2019-12-07”,“yyyy-MM-dd”,System.Globalization.CultureInfo.InvariantCulture).Date

Cheers @KarthikBallary

I have used if cdate(strDate)<cdate(now.toString(“yyyy-MM-dd”) and its working fine

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.