I want to convert current date and time into system date format (It may change).
For an example Now is returning me date and time in 07/03/2020 (MM/dd/yyyy)15:00:02 and my system date format is 03/07/2020(dd/MM/yyyy) 15:00:02 (It can be 7/3/2020(M/d/yyyy) 03-07-2020(dd-MM-yyyy)).
I tried with getting the current culture method but it is always returning 07/03/2020 (MM/dd/yyyy - Invariant culture)
Hi @dimibot, somehow you reached to the solution but code is calculating according to Geo Location(Nation/Country/region), It should be calculating as per the selected Regional format
Indeed it was checking the Region set in Control Panel.
I think I found a better solution: In Registry Editor Under HKEY_CURRENT_USER/Control Panel/International
You have the date and time format of the machine.
For example if you want to get the ShortDate then you need an assign activity:
string shortDateFormat = Microsoft.Win32.Registry.CurrentUser.OpenSubKey(“Control Panel\International”).GetValue(“sShortDate”)
Others values you can use there are: sShortTime, sTimeFormat, sLongDate etc.
@dimibot Wow, Thank you very much, it worked!
But I think there should be something from the Microsoft and UiPath, I have gone through many posts regarding the same problem in UiPath forum, StackOverflow, SuperUser etc. but they were just mentioning about the CultureInfo but that is not a solution of Regional Settings.