Convert date format in dynamic values

Hi I am new to UI path

I have a doubt. I am getting values(dates) from excel in MM/dd/yyyy as string. I want it to be stored as date format. Because I need to compare two date. Date which I read from excel and current date.

I tried this :
DateTime.ParseExact( One , “d-M-yyyy”, System.Globalization.CultureInfo.InvariantCulture).ToString(“MM/dd/yyyy”) where one is the variable in string which values I am getting from excel ex: 7/2/2024.

Can someone please help we with this. I want it to store in date format so I can perform which date is recent operation.

Thankyou in advance.

Hi @588b97c268cd7dd244bd4707e

excelDate = DateTime.ParseExact(One, "M/d/yyyy", System.Globalization.CultureInfo.InvariantCulture)

Hi @588b97c268cd7dd244bd4707e

dateString = row("YourDateColumnName").ToString
parsedDate = DateTime.ParseExact(dateString, "MM/dd/yyyy", System.Globalization.CultureInfo.InvariantCulture)
currentDate = DateTime.Now


If parsedDate > currentDate Then
    ' parsedDate is more recent than currentDate
Else
    ' currentDate is more recent or they are the same
End If


Regards,

@588b97c268cd7dd244bd4707e

You can use the below

CDate(valuefromExcel) > Now

Cheers