I have a problem with a C # build (.net 2.0 written using Visual studio 2005) installed on a UK server and using the UK regional settings.
What my code does is convert the date in the form of dd / MM / yyyy to utc. those. yyyy-mm-dd. The problem arose with dates such as 02/16/2010, when the component was unable to convert the date and returned an error. After debugging, I realized that, for some strange reason, CultureInfo returned by System.CultureInfo is en-US.
I can programmatically change these settings using:
Thread.CurrentThread.CurrentCulture = new CultureInfo("en-GB", false);
and my code is working fine.
However, I do not want to do this all the time, since my system should be UK. Not to us. So, how do I change the default culture for the .Net framework by default en-GB instead of en-US?
For information:
- I tried to update the machine.config file and specify culture = en-GB for the globalization partition (it was set to neutral), but it also did not work [did it for 1.1 and 2.0], but it is possible I did not change it correctly.
- I checked my regional settings for Windows and is definitely configured for the UK with dates like dd / MM / yyyy
- I work on a virtual server and checked my host system. It is also installed in the UK.
Edit:
A bit of additional information about the context. The corresponding assembly is called through COM interaction from its own C ++ component, which works as a COM + application.
andynormancx
source share