I have an issue with date conversions in UiPath where my computer’s regional date format is “dd/mm/yyyy”, which works fine with every application and automation I’ve done until now, but when using the CDate function to convert a string to a date, it gives me an error as it expects a “mm/dd/yyyy” format. I’ve seen online that this function uses the local date format, which isn’t that of my computer, and I can only assume, is internal to studio. While I can just split and rearrange dates in some cases, I’d like to know if there’s a way to change the setting for studio itself ? I tried changing the language to one that uses ddmmyyyy, but the issue didn’t change at all.
Any ideas on how to do it ?
No you cannot change UiPath Studio’s internal locale so that CDate will just work with dd/MM/yyyy but you can use workflow’s culture before calling CDate but for this you have to use 2 Assign Activity at the starting and include this
System.Threading.Thread.CurrentThread.CurrentCulture = New System.Globalization.CultureInfo("en-GB") in 1st Assign
System.Threading.Thread.CurrentThread.CurrentUICulture = New System.Globalization.CultureInfo("en-GB") in 2nd Assign
Thank you both for these explanations !
Since these assigns are made to system values, do they affect studio itself and therefore only need to be done once, or do they still need to be applied before the use of dates, numbers and other formats ?
These affect only the current workflow execution thread. They do not change Windows settings, UiPath Studio settings, or your machine’s locale. When the workflow execution ends then it reverse back to normal format.