Date format switches months with days

Felix Oehl

New Member
I currently have 4 VMs set up in a server/runtime resource config; 2 machines for a test environment and 2 for a production environment. One of the machines (the test runtime resource) is handling dates natively in Blue Prism as MM/dd/yyyy while all other machines use dd/MM/yyyy.

As an example, if I perform AddDays(01/03/2020,1) on 3 of the machines and the result is 02/03/2020 as expected, but on this one machine, I get 01/04/2020. If I use the date picker in the Evaluate Expression window to pick the 1st of March 2020 on that machine the field is filled with 03/01/2020.

The regional settings of the machine are set to dd/MM/yyyy and all other regional settings match the production runtime VM, but the problem persists.

Any ideas?
 

sahil_raina_91

Active Member
Without diving into the Root Cause (since it may happen due to various reasons), here is 1 way to resolve :
Force the Culture using a code stage with following code :
Threading.Thread.CurrentThread.CurrentCulture = New Globalization.CultureInfo(Culture_Name, True)

Culture_Name:
"en-US" will set culture to English (United States) which uses mm/dd/yyyy
"en-GB" will set culture to English (United Kingdom) which uses dd/mm/yyyy
Experiment with others also.

That code needs to be run before you perform any Date&Time calculations

Reference : https://docs.microsoft.com/en-us/bi...-parameters-and-types/supported-culture-codes
Caution: Forcing a culture may impact other numerical, text comparisons, NOT just the Date Formats. So make sure to test. (For us, it didn't impact)
 
Last edited:

Ny.x

New Member
I currently have 4 VMs set up in a server/runtime resource config; 2 machines for a test environment and 2 for a production environment. One of the machines (the test runtime resource) is handling dates natively in Blue Prism as MM/dd/yyyy while all other machines use dd/MM/yyyy.

As an example, if I perform AddDays(01/03/2020,1) on 3 of the machines and the result is 02/03/2020 as expected, but on this one machine, I get 01/04/2020. If I use the date picker in the Evaluate Expression window to pick the 1st of March 2020 on that machine the field is filled with 03/01/2020.

The regional settings of the machine are set to dd/MM/yyyy and all other regional settings match the production runtime VM, but the problem persists.

Any ideas?
I have just solved this issue.

We have had new Virtual Machines with the server-based in Germany changing from the UK.

I updated the Administrative Calander Dates to the UK and checked Beta: Use Unicode UTF-8 for windows language support
 

Attachments

  • image001.png
    image001.png
    177.7 KB · Views: 31
  • image002.png
    image002.png
    49 KB · Views: 25
Top