Parse string to datetime error


I Have a value I read out my excel I need to parse to a datetime value.
Datum = Date.ParseExact(row.item(5).ToString,“dd/MM/yyyy”,CultureInfo.InvariantCulture)

datum is a datetime variable. But i get the error: String was not recognized as a valid DateTime.

any idea how to solve this?

Hey @seldo

Reason is, your row(5).tostring might contain date as well.
To check it, you can log this in output pane and check exact output.

Try This

Datum = Date.ParseExact(row.item(5).ToString,“dd/MM/yyyy hh:mm”,System.globalization.CultureInfo.InvariantCulture)


Datum = Date.ParseExact(row.item(5).ToString,“dd/MM/yyyy hh:mm:ss”,System.globalization.CultureInfo.InvariantCulture)

I get the same error. And i checked my excel and the row.item(5) is a date in excel

Just try printing row.item(5).tostring in output pane using write line and share results please

DatetoString.xaml (5.1 KB)

Hi @seldo

I have one string varibale having datetime and i am converting it into Date time variable.

please find the attached xaml for reference.

Latika (8.1 KB)

Hi @seldo

I have created date string value reading from excel and converting into datetime.

Please find the attached workflow for your reference.


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