I am trying to convert a String into DateTime Variable, but the following Error occoured: “The DateTime represented by the string is not supported in calendar System.Globalization.GregorianCalendar”
Here is what i did: (I replaced my Stringvalue with DateTime.now.toString, because it throws the same Error)
Log Message
DateTime.now.toString
Assingn
Test (DateTime) = DateTime.ParseExact(DateTime.now.ToString,“dd/MM/yyyy
HH:mm:ss”,system.globalization.CultureInfo.InvariantCulture)
Output:
Test started
28/07/2022 15:30:21
Assign: The DateTime represented by the string is not supported in calendar System.Globalization.GregorianCalendar
Why are you converting a datetime (DateTime.Now) to string and then trying to convert it back? This makes no sense. DateTime.Now gives you a datetime value.
you tried to parse a string and got the exception from above
for a cross check you tried instead of the variable now.ToString but got also the same exception from above
so check the format of your string and adapt it accordingly in your statement. We would recommend to do quick prototyping during debugging within the immediate panel