The DateTime represented by the string is not supported in calendar System.Globalization.GregorianCalendar

Hi all,

I’m having this error: “If: The DateTime represented by the string is not supported in calendar System.Globalization.GregorianCalendar” in the condition of my if statement which has this code: DateTime.ParseExact(var_currentDeadlineConsultant.ToString.Substring(0,10),“MM/dd/yyyy”,CultureInfo.InvariantCulture)<system.DateTime.Today.AddDays(25)

The “var_currentDeadlineConsultant” is a generic value which derived a date from a datatable field.

2 Likes

Try using

Convert.toDateTime(var_currentDeadlineConsultant.ToString.Substring(0,10))<system.DateTime.Today.AddDays(25)

1 Like

Hi, thanks for your reply @Vivek_Arunagiri,

Sorry for the delay, but I get the following error: “String was not recognized as a valid DateTime.”

No need to invest your time. I solved it in the meantime.
My excel format was dd/MM/yyyy but in the background it switched to MM/dd/yyyy while writing a line in uipath

4 Likes

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