Date and Time format strings in .NET – InvariantCulture

If you wish to have a deterministic format, but do not want to use a specific culture, you can use InvariantCulture.

InvariantCulture represents no culture at all – it is associated with the English language, though no specific country/region.

See Using the InvariantCulture Property on MSDN.

Here is an example of its use:

DateTime dt = new DateTime(2011, 11, 21, 12, 34, 56);
Console.WriteLine(dt.ToString(CultureInfo.InvariantCulture));
Share:
error

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.