I am automating a process in which I need to use Date Time values. I am having problems because the date time variable is always written in the excel file in format MM/dd/yyyy. For this case I found the solution of using the 2 assign activity.
1st Assign: VarDT = DateTime.Now.ToString(“dd/MM/yyyy”) as string variable.
2nd Assign: VarDT = DateTime.ParseExact(hoy.toString(), “MM/dd/yyyy”, Globalization.CultureInfo.InvariantCulture).ToString(“dd/MM/yyyy”)
By this way it had been working, but today it appeared this error message: “The string represents an unsupported DateTime in the System.Globalization.GregorianCalendar calendar.”
So, I do not understand why sometimes it works fine just with the first assign activity, and other days I do need to use the 2nd assign activity.
I hope the explanation is easy to understand.
Many thanks in advance .