Thursday, January 27, 2011

DateTime formate C#,vb asp.net 4.0

DateTime.Now; 1/27/2011 11:22:45 AM
DateTime.Now.ToString(); 1/27/2011 11:22:45 AM
DateTime.Now.ToShortTimeString() 11:22 AM
DateTime.Now.ToShortDateString() 1/27/2011
DateTime.Now.ToLongTimeString() 11:22:45 AM
DateTime.Now.ToLongDateString() Thursday, January 27, 2011





DateTime.Now.ToString("d")
 
1/27/2011
DateTime.Now.ToString("D")
 
Thursday, January 27, 2011
DateTime.Now.ToString("f")
 
Thursday, January 27, 2011 11:22 AM
DateTime.Now.ToString("F")
 
Thursday, January 27, 2011 11:22:45 AM
DateTime.Now.ToString("g")
 
1/27/2011 11:22 AM
DateTime.Now.ToString("G")
 
1/27/2011 11:22:45 AM
DateTime.Now.ToString("m")
 
January 27
DateTime.Now.ToString("r")
 
Thu, 27 Jan 2011 11:22:45 GMT
DateTime.Now.ToString("s")
 
2011-01-27T11:22:45
DateTime.Now.ToString("t")
 
11:22 AM
DateTime.Now.ToString("T")
 
11:22:45 AM
DateTime.Now.ToString("u")
 
2011-01-27 11:22:45Z
DateTime.Now.ToString("U")
 
Thursday, January 27, 2011 5:22:45 PM
DateTime.Now.ToString("y")
 
January, 2011
DateTime.Now.ToString("dddd, MMMM dd yyyy")
 
Thursday, January 27 2011
DateTime.Now.ToString("ddd, MMM d "'"yy")
 
Thu, Jan 27 '11
DateTime.Now.ToString("dddd, MMMM dd")
 
Thursday, January 27
DateTime.Now.ToString("M/yy")
 
1/11
DateTime.Now.ToString("dd-MM-yy")
 
27-01-11

 

 
 

No comments: