June 2003
Intermediate to advanced
800 pages
34h 20m
English
You want to convert a date or time into a formatted string that has the same representation, regardless of the globalization settings of the current computer.
Use the overloaded DateTime.ToString method that accepts an IFormatProvider instance, and supply the DateTimeFormatInfo.InvariantInfo object.
In some cases, you want dates to be formatted identically regardless of the settings on the computer running the code. This might be the case if the string value of the date is being inserted into a legacy database. Using a custom format string will offer some protection (if you are careful to only use numeric date information), but to be completely reassured you should specify the culture ...
Read now
Unlock full access