Not valid DateTime to convert

I’m trying to convert the Now DateTime from month/day/year to day/month/year but it’s keep sending me the same error and I can’t figure the way to fix it, any suggestions? Captura

Please use the below expression -

strDate = DateTime.Now.ToString("dd/MM/yyyy hh:mm:ss")

I don’t need the string in this case, I need to use the DateTime with that format

it doesn’t work, doesn’t change the format for the needed one it let it as it was

what are you trying to do?
If you want the date in particular format, you must convert it into string.

DateTime object doesn’t have any fixed format.

I need to convert the actual date format (MM/dd/yyyy hh:mm:ss) into the new one (dd/MM/yyyy hh:mm:ss) to use it with an external activity that only gets the new format

I’m not able to change it to the new format and it’s needed for the process to work

What is the data type of external activity input?
If the input type is datetime object, you no need to worry about the date time format.

it’s dateTime, but the result of the activity returns error if I don’t write the proper dateTime

Just pass the following input value.

DateTime.Now

It will work.

I tried, it doesn’t let me, it must be day/month/year hour:minute:second

Refer the below thread once.
I guess you have to pass the culture info (as per your need) -

Regards,
Karthik Byggari

This is really interesting…!

@anon36905250

I will also try to work on it…but we can use parseexact as @KarthikByggari suggested it would work…Still strange why its not taking

lets see, bravo…!

is still giving me the not recognized DateTime, I have the 2018.2 uipath studio version, don’t know if that’s important

I did manage to fix it, but now I have a gregorianCalendar error

done, I only required to change the cultureInfo to the one I could use this format (in my case it was es-ES)

1 Like

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