Date not recognized as valid format

I am getting this error while trying to get a date from excel. In excel it’s in ‘dd/MM/yyyy’ format but while executing, I get this error with excel data in ‘MM/dd/yyyy hh:mm:ss’ format. Kindly help me out here!

Hi @Chendoran_M

How about this expression?

DateTime.ParseExact("Input string","dd/MM/yyyy hh:mm:ss",System.Globalization.CultureInfo.InvariantCulture).ToString("MM/dd/yyyy")


HI seems like it didnt get recognized as date because the for mat is ‘mm/dd/yyyy hh:mm:ss’




this will cut the hh:mm:ss

try to adjust it



Try this:

Datetime.ParseExact(Strinput.ToString, "MM/dd/yyyy", System.Globalization.CultureInfo.InvariantCulture).ToString("dd/MM/yyyy")


I have tried substring and the hh:mm:ss format is removed now but I’m getting the below error.

"Source: Assign

Message: The DateTime represented by the string ‘08/15/2022’ is not supported in calendar ‘System.Globalization.GregorianCalendar’."

can i see your assign script?


Please try to read the excel via Excel application scoop and try to parse the date.

I have used workbook readrange

row(“columnname”).tostring.split(" "c).toarray(0).tostring

Please try with Excel within ExcelApplicationScoop

Datetime.ParseExact(CurrentRow(“DATE OF DEPARTURE”).ToString.SubString(0,10),“MM/dd/yyyy”,System.Globalization.CultureInfo.InvariantCulture).ToString(“dd/MM/yyyy”)

I’ve tried this and still getting this error:


Source: Assign

Message: The DateTime represented by the string ‘15/08/2022’ is not supported in calendar ‘System.Globalization.GregorianCalendar’."

I don’t understand why am I getting this when the date format is changed to ‘dd/MM/yyyy’

first try to check this

seems like you can set the correct value from excel app (dd/MM/yyyy) and then


Datetime.ParseExact(CurrentRow(“DATE OF DEPARTURE”).ToString.SubString(0,10),“dd/MM/yyyy”,System.Globalization.CultureInfo.InvariantCulture).ToString(“dd/MM/yyyy”)

Tried it… still the same;

Message: The DateTime represented by the string ‘08/15/2022’ is not supported in calendar ‘System.Globalization.GregorianCalendar’.

This is what happens to me as well…
My excel format was dd/MM/yyyy but in the background it switched to MM/dd/yyyy while writing a line in uipath

when I tried this;
Datetime.ParseExact(CurrentRow(“DATE OF DEPARTURE”).ToString.SubString(0,10),“MM/dd/yyyy”,System.Globalization.CultureInfo.InvariantCulture).ToString(“dd/MM/yyyy”)

the date format got converted from “MM/dd/yyyy” to “dd/MM/yyyy” but I get an error while executing, stating that
The DateTime represented by the string ‘15/08/2022’ is not supported in calendar ‘System.Globalization.GregorianCalendar’."

Hi @Chendoran_M

Try this

DateTime.ParseExact(row("Columnname").tostring,"dd/MM/yyyy hh:mm:ss",System.Globalization.CultureInfo.InvariantCulture).ToString("dd/MM/yyyy")

Can you tell me the input date format and output data format


Input date format: MM/dd/yyyy
Output date format: dd/MM/yyyy

I am reading the input value from the excel, where the date is in dd/MM/yyyy format but while checking it in uipath, the date format is read from excel as MM/dd/yyyy

Hi @Chendoran_M

Can you share the sample input excel file here

UserInputData.xlsx (9.5 KB)

HI @Chendoran_M

Have a look on the XAML file

Excel Date.xaml (7.2 KB)


1 Like

Thank you @Gokul001.

I am passing this ‘str_User_DepDate’(which holds the date read from excel) variable to another workflow, where the argument’s data type is ‘DateandTime’
and I have converted the string to date and time by using this ‘Convert.ToDateTime(str_User_DepDate)’ but I am getting this error stating;
“Invoke WebDataExtraction workflow: String ‘15/09/2022’ was not recognized as a valid DateTime.” Any idea on how to solve this?

Hi @Chendoran_M

Can you please create a new topic to discuss this aspect.