String was not recognize as valid DateTime

Hi Everyone,

I am having issues in converting string value to datetime variable using assign activity

I am getting the error below:

I already use the function below: but I still get the error message

for my source file please see this:
TestFile.xlsx (10.2 KB)

I iterate on all those list using for each data table

Hopes someone can help me

Thank you!

Hi, when using DateTime.ParseExact, it does as the name suggests and looks for the exact format you gave, in your case “MM/dd/yyyy”. When read from the TestFile.xlsx the format actually includes the time too and it looks like this: “MM/dd/yy hh:mm:ss”.
You need to use either: DateTime.ParseExact(dateTimeAsString, “MM/dd/yyyy hh:mm:ss”, System.Globalization.CultureInfo.InvariantCulture)
or DateTime.Parse(dateTimeAsString).

Thank you! It worked! @Bogdan_Eusebiu_Siritanu!

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