Hello,
I am trying to convert the following Date from excel to DateTime but I get this error:
Conversion from string “44053” to type ‘Date’ is not valid.
UIPath Studio sees the date as string:
And this is what i have tried:
Hello,
I am trying to convert the following Date from excel to DateTime but I get this error:
Conversion from string “44053” to type ‘Date’ is not valid.
UIPath Studio sees the date as string:
And this is what i have tried:
Hi,
It’s serial value in excel. Can you try the following?
DateTime.FromOADate(Double.Parse(cell.ToString))
or
You can get it as string (Not numeric serial value but date string) if you set true PreserveFormat proerty of ReadRange/ReadCell activity.
Regards,
Thank you, FromOADate solved my case, I am looking at the preserve format since not all might get that type.
Attempting to use the PreserveFormat property. I expected a date string but instead it
was “[$-4442289]m/d/yy h:mm AM/PM”
How can this value be converted to DateTime?
That is OADate time format, and I’ve converted it using this:
Datetime.FromOADate(Convert.ToDouble(cell.ToString)).ToString("MMM-yy").Equals(DateTime.Now.Tostring("MMM-yy"))
Thank you! I found that turning off PreserveFormat property the result (44227.6549074074) can be assigned to Double and convert with DateTime.FromOADate as you suggested.