String was not recognized as a valid DateTime like "45175"

Hi all,

I read Excel file have D column Date format but when read is: 45175,45180,45181
I use some suggestions but not work. Can help me check, thank all

DateTime.ParseExact(ngayhd, “dd/MM/yyyy”, System.Globalization.CultureInfo.InvariantCulture).ToString

DateTime.ParseExact(in_PaymentStartDate.ToString, “dd/MM/yyyy”, nothing).toString(“dd/MM/yyyy”)



Hi @anh.nguyen ,
Check read range activity property
tick “PreserveFormat”
hope it help

Thank you,

When I check it show Date format but other column I use code as below, it = 0?

Before I check “Preserve Format” can calculate formula

Can you share your original file and detail requirements?
Or you can try convert only columns date Cdate(row(yourcolumnsname).ToString(“dd/mm/yyyy”))
I think your file have valid format,

1 Like


You can use the following expression to convert an Excel date value (e.g., 45175) to a formatted date string:


1 Like


We have a knowledge base in UiPath forum on DATETIME

For your query

Convert a OADate in excel to a Datetime or string Datetime

Suppose Actual value being entered: ‘43800’ but the required value is “1-Dev-2022” in format “dd-MMM-yyyy”

Then use this in assign activity

str_datetime = DateTime.FromOADate(Convert.ToDouble(Strinput.ToString)).ToString(“dd/MM/yyyy”)

Have a view on this for all functions in Datetime

Cheers @anh.nguyen

1 Like

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