Convert String to DateTime throws Error

Let us summarize what we did understand so far

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

Kindly note:
grafik

when trying to parse it with:

DateTime.ParseExact(strYourVar,"dd/MM/yyyy HH:mm:ss"system.globalization.CultureInfo.InvariantCulture)

then please note the swap from day and month info
grafik

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

:ambulance: :sos: [FirstAid] Datatable: Debug & Analysis invalid DateTime Strings / String to DateTime Parsing Issues - News / Tutorials - UiPath Community Forum