Display date or time in MVC

Madhu.B.Rokkam
Posted by Madhu.B.Rokkam under ASP.NET category on | Points: 40 | Views : 3349
Samples to display date or time in MVC

MVC Date in short form
@DateTime.Now.ToString("d")

Output format
***********************
10/26/2012

For time only
@DateTime.Now.ToString("T")

Output format
***********************
9:17:37 AM

For Long date only
@DateTime.Now.ToString("D")

Output format
***********************
Friday, October 26, 2012

Comments or Responses

Login to post response