DateTime format and invariant culture.

Invariant culture is always the same, regardless of the computer's settings:


using System;
using System.Text;
using System.Globalization;
class Sample
{
    public static void Main()
    {
        DateTime dt = new DateTime(2000, 1, 2);
        CultureInfo iv = CultureInfo.InvariantCulture;
        Console.WriteLine(dt.ToString(iv));
        Console.WriteLine(dt.ToString("d", iv));
    }
}

The output:


01/02/2000 00:00:00
01/02/2000
java2s.com  |  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.