What is wrong with the following?
@Convert.ToDateTime((@item.Date.ToShortDateString())," dd - M - yy")
@item.Date is showing 20/11/2005 12:00 a.m and I want to display 20 Nov 2011
Try:
@item.Date.ToString("dd MMM yyyy")
or you could use the [DisplayFormat]
attribute on your view model:
[DisplayFormat(DataFormatString = "{0:dd MMM yyyy}")]
public DateTime Date { get; set }
and in your view simply:
@Html.DisplayFor(x => x.Date)