DateTime Now Format In US Format Instead of Local - How To Change It?


I’ve used the “Now” value assigned to a DateTime var type. When I display the info stored in the DateTime var using a Message Box, it shows up in the “month/date/year time” format instead of in the “date/month/year time” format.

Is that behaviour normal and the only way to change that is to format it in UiPath Studio? If not, how can it be changed at the system level so it shows up in UiPath Studio automatically?



My machine’s language settings are:

My machine’s date and time format are in the date/monthyear format:


You can change the format as you want as below,

timeToday = Now().tostring(“dd/MM/YY HH:mm”)

Hope this will help you,
Suresh J

Hi @sureshj,

I came across this option when searching for a solution in previous community answers. It doesn’t work because the validation machine says:

This is because var timeToday is system.dateTime var:

I tried changing the var type to GenericValue, but then the code breaks further down where a Subtract function is performed using a TimeSpan var because Subtract won’t work on a GenericValue var:

So, it seems Now() when used with a DateTime var, the default format of the output remains “month/date/year time”.

Anyway, thanks Sureshj.

It appears I don’t have to worry about changing the format at the beginning of the code. I can do so just before writing it into a file (in this case, an Excel sheet):


This is not the solution I was looking for, but will do for now. I was just wondering why Now() when used with a DateTime var won’t show the date and time in the format of the machine’s regional setting.

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