How to compare a date with format dd/MM/yyyy against today?

Hello,

The date has the following format: dd/MM/yyyy.
When I use:

cINT(DateDiff(DateInterval.Day,cDATE(Date),today))>1

It does not work

Thanks!

image

try giving today.toshortstring @EngAnalyst

1 Like

“toshortstring is not a member of date”

Sorry , it is ToShortDateString

“no accessible datediff can be called with these arguments”

image

Convert both the dates to date type using CDate

CDate(Today.ToShortDateString)

doesnt work

This is working for me…

Dim datestr1 As Date = CDate(“07/07/2019”)
Dim datestr2 As Date = CDate(Today.ToShortDateString)
MessageBox.Show(DateDiff(DateInterval.Day, datestr1, datestr2).ToString)

Take this as reference and create the workflow

The problem is that in my example the date is in the format dd/MM/yyyy instead of MM/dd/yyyy and i think UiPath does not recognize it

CDate(CDate(“07/07/2019”).ToString(“dd/MM/yyyy”))

Try converting your date then :slight_smile:

I tried but it doesnt work

image

In my case the date obtained is 19/02/2018. When i manually set 02/19/2018 it works

Edit: i also tried “MM/dd/yyyy” and it does not work.

@EngAnalyst first convert the date which is in string to date time format like datetime.parseexact(datestring,“dd/MM/yyyy”,system.globalization.culturalinfo.invariantculture) this will give you the output of string into datetime.now to compare this store the above expression in a variable say outdate by using if condition give like outdate=now.date try this once let me know if anything goes wrong.