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?
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”.
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.