.Net Compact Framework – Sets the locale for you
2009 August 10
When you are developing in the .Net Compact Framework and try to output things like date, time, or any numbers you should take care to pay attention to the device’s locale. The reason is that in some countries they use “.” for decimals and in others they use “,”. There are other differences too, like how dates are formatted internationally.
The solution here, if you need to ALWAYS output data in your specific format, is to pass in an “Invariant Culture” to the string output like so:
-
*Time.ToString("yyyy-MM-dd HH:mm:ss", CultureInfo.InvariantCulture);
(where *Time is your time variable)
Sphere: Related Content