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