Different Date-Format in ASP.NET

Here are some examples of the different date format in c#, and You can customize this also as per your requirement. Hope it will help. 
 

DateTime dt = DateTime.Now;

Response.Write(dt + "</br>"); //output-1/16/2014 6:13:04 PM

Response.Write(String.Format("{0:y yy yyy yyyy}", dt) + "</br>"); //output- 14 14 2014 2014

Response.Write(String.Format("{0:M MM MMM MMMM}", dt) + "</br>"); //output- 1 01 Jan January

Response.Write(String.Format("{0:d dd ddd dddd}", dt) + "</br>");//output- 16 16 Thu Thursday

Response.Write(String.Format("{0:h hh H HH}", dt) + "</br>");//output- 5 05 17 17

Response.Write(String.Format("{0:m mm}", dt) + "</br>"); //output- 55 55

Response.Write(String.Format("{0:s ss}", dt) + "</br>"); //output- 31 31

Response.Write(String.Format("{0:f ff fff ffff}", dt) + "</br>");//output- 5 50 502 5022

Response.Write(String.Format("{0:F FF FFF FFFF}", dt) + "</br>");//output- 5 5 502 5022

Response.Write(String.Format("{0:t tt}", dt) + "</br>");//output- P PM

Response.Write(String.Format("{0:z zz zzz}", dt) + "</br>");//output- +5 +05 +05:30

Response.Write(String.Format("{0:d/M/yyyy HH:mm:ss}", dt) + "</br>");//output- 16/1/2014 17:55:31

Response.Write(String.Format("{0:d/M/yyyy HH:mm:ss}", dt) + "</br>");//output-16/1/2014 17:55:31

Response.Write(String.Format("{0:M/d/yyyy}", dt) + "</br>");//output- 1/16/2014

Response.Write(String.Format("{0:MM/dd/yyyy}", dt) + "</br>");//output- 01/16/2014

Response.Write(String.Format("{0:ddd, MMM d, yyyy}", dt) + "</br>");//output- Thu, Jan 16, 2014

Response.Write(String.Format("{0:dddd, MMMM d, yyyy}", dt) + "</br>");//output- Thursday, January 16, 2014

Response.Write(String.Format("{0:MM/dd/yy}", dt) + "</br>");//output- 01/16/14

Response.Write(String.Format("{0:MM/dd/yyyy}", dt) + "</br>");//output- 01/16/2014

Response.Write(String.Format("{0:t}", dt) + "</br>");//output- 5:55 PM

Response.Write(String.Format("{0:d}", dt) + "</br>");//output- 1/16/2014

Response.Write(String.Format("{0:T}", dt) + "</br>");//output- 5:55:31 PM

Response.Write(String.Format("{0:D}", dt) + "</br>");//output- Thursday, January 16, 2014

Response.Write(String.Format("{0:f}", dt) + "</br>");//output- Thursday, January 16, 2014 5:55 PM

Response.Write(String.Format("{0:F}", dt) + "</br>");//output- Thursday, January 16, 2014 5:55:31 PM

Response.Write(String.Format("{0:g}", dt) + "</br>");//output- 1/16/2014 5:55 PM

Response.Write(String.Format("{0:G}", dt) + "</br>");//output- 1/16/2014 5:55:31 PM

Response.Write(String.Format("{0:m}", dt) + "</br>");//output- January 16

Response.Write(String.Format("{0:y}", dt) + "</br>");//output- January, 2014

Response.Write(String.Format("{0:r}", dt) + "</br>");//output- Thu, 16 Jan 2014 17:55:31 GMT

Response.Write(String.Format("{0:s}", dt) + "</br>");//output- 2014-01-16T17:55:31

Response.Write(String.Format("{0:u}", dt) + "</br>");//output- 2014-01-16 17:55:31Z