Format |
Code |
Result |
MM/dd/yyyy |
Date.Now().ToString(”d”) |
1/15/2010 |
dddd, dd MMMM yyyy |
Date.Now().ToString(”D”) |
Friday, January 15, 2010 |
dddd, dd MMMM yyyy hh:mm tt |
Date.Now().ToString(”f”) |
Friday, January 15, 2010 11:06 AM |
dddd, dd MMMM yyyy HH:mm:ss |
Date.Now().ToString(”F”) |
Friday, January 15, 2010 11:06:46 AM |
MM/dd/yyyy h:mm tt |
Date.Now().ToString(”g”) |
1/15/2010 11:06 |
MM/dd/yyyy HH:mm:ss |
Date.Now().ToString(”G”) |
1/15/2010 11:06 |
MMMM dd |
Date.Now().ToString(”m”) |
15-Jan |
dd MMM yyyy HH’:'mm’:’ss ‘GMT’ |
Date.Now().ToString(”r”) |
Fri, 15 Jan 2010 11:06:46 GMT |
yyyy’-'MM’-'dd’T'HH’:'mm’:’ss |
Date.Now().ToString(”s”) |
2010-01-15T11:06:46 |
yyyy’-'MM’-'dd HH’:'mm’:’ss’Z’ |
Date.Now().ToString(”u”) |
2010-01-15 11:06:46Z |
dddd, MMMM dd yyyy HH:mm:ss |
Date.Now().ToString(”U”) |
Friday, January 15, 2010 3:06:46 AM |
yyyy MMMM |
Date.Now().ToString(”y”) |
January, 2010 |
Thursday, March 15, 2012
.NET Custom DateTime Format Strings
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment