Culture-sensitive date/time format strings

Format stringMeaning
dShort date
DLong date
tShort time
TLong time
fLong date + short time
FLong date + long time
gShort date + short time
G (default)Short date + long time
m, MMonth and day
y, YYear and month

using System;
using System.Text;
using System.Globalization;
class Sample
{
    public static void Main()
    {
        DateTime dt = new DateTime(2000, 1, 2, 17, 18, 19);
        Console.WriteLine("{0:d}", dt);
    }
}

The output:


1/2/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.