Converting to date Format

i was trying to read and convert a value from the Config.xlsx file to a date format as shown below using an assign statement.

DateTime.ParseExact(in_Config(“validDate”).ToString, “yyyy-MM-dd”, System.Globalization.CultureInfo.InvariantCulture)

I run into the following error.

Assign - Filter Date: String was not recognized as a valid DateTime.

Existing solutions on the forum didn’t work … Appreciate your help. here is the excel value:


Hi @Hara_Gopal

Can you try updating the Date in config file to: 2018-01-01 matching the format to what you have put in the ParseExact.

Also Below is the link ,Please have a read about ParseExact here.


Hope this would help you resolve this
Usually when we get the date value from excel it will come in this format dd/MM/yyyy hh:mm:ss
To ensure that use a write line activity inside the for each row loop and mention Like this row(“yourcolumnname”).ToString this will print the value in the output panel

The reason why i suggest on this is because we need to mention only that format in the ParseExact method
Dat_output = DateTime.ParseExact(in_Config(“validDate”).ToString.SubString(0,10),“dd/MM/yyyy”,System.Globalization.CultureInfo.InvariantCulture)

The highlighted place is where we need to mention the format of the input we give from in_config
Here we use SubString to get only dd/MM/yyyy from dd/MM/yyyy hh:MM:sss

Where Dat_output is a variable of type DateTime

Hope this would help you
Cheers @Hara_Gopal

1 Like