| Format string | Meaning |
|---|---|
| d | Short date |
| D | Long date |
| t | Short time |
| T | Long time |
| f | Long date + short time |
| F | Long date + long time |
| g | Short date + short time |
| G (default) | Short date + long time |
| m, M | Month and day |
| y, Y | Year 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. |