Assign Date Column

Hello,

I’m using a For Each Row to loop through a datatable and adjust the column data (trim, replace, adjust date formats). The datatable is coming excel using Read Range activity

I keep getting “String was not recognized as a valid DateTime” errors with this Assign Value.

DateTime.ParseExact(row(“Date_of_Birth”).Tostring, “d-MMM-yyyy”, CultureInfo.InvariantCulture)

My goal is to get the data in “d/mm/yyyy” format. I’m trying to remove leading zeros from the dates in excel spreadsheets (eg. 04/11/2021).

Any help would be greatly appreciated.

thanks,

Tim

Hi @timothy.mullady

Try this assign activitiy

date_1= DateTime.ParseExact(DateTime.ParseExact(row(“Date_of_Birth”).Tostring, “dd-MMM-yyyy”, CultureInfo.InvariantCulture).ToString(“d-MMM-yyyy”),“d-MMM-yyyy”,CultureInfo.InvariantCulture)

Hello.
I tried this and got the same error.

Thanks,

tim

did u checked the preserve format option in read range?

DateTime.ParseExact(row(“Date_of_Birth”).Tostring, “d-MM-yyyy”, CultureInfo.InvariantCulture)

try this