Saturday, 26 October 2013

How to render a DateTime in a specific format in ASP.NET MVC 3?

If all you want to do is display the date with a specific format, just call:
@Model.LeadDate.ToString("dd-MMM-yyyy")

@Model.LeadDate.ToString("MM/dd/yy")
It will result in following format,

26-Sep-2013
10/26/13

No comments:

Post a Comment