Skip navigation

Various date formatting options in dotnet

Hi,

Here is a complete list of various date formating options using now().

DateTimes Produced by Now.ToString("x") Where x is the first column below

d 2/12/2004
D Thursday, February 12, 2004
f Thursday, February 12, 2004 8:37 PM
F Thursday, February 12, 2004 8:37:51 PM
g 2/12/2004 8:37 PM
G 2/12/2004 8:37:51 PM
m February 12
M February 12
r Thu, 12 Feb 2004 20:37:51 GMT
R Thu, 12 Feb 2004 20:37:51 GMT
s 2004-02-12T20:37:51
t 8:37 PM
T 8:37:51 PM
u 2004-02-12 20:37:51Z
U Friday, February 13, 2004 4:37:51 AM
y February, 2004
Y February, 2004
Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish