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)
More Related Contents:
- Escape @ character in razor view engine
- How can I use a reportviewer control in an asp.net mvc 3 razor view?
- What is the @Html.DisplayFor syntax for?
- Razor HtmlHelper Extensions (or other namespaces for views) Not Found
- Checkbox for nullable boolean
- dropdownlist set selected value in MVC3 Razor
- MVC Razor dynamic model, ‘object’ does not contain definition for ‘PropertyName’
- How to add extra namespaces to Razor pages instead of @using declaration?
- Unexpected “foreach” keyword after “@” character
- Loading a partial view in jquery.dialog
- The name ‘model’ does not exist in current context in MVC3
- The name ‘ViewBag’ does not exist in the current context
- Is it possible to display raw Html from database in ASP.NET MVC 3?
- Razor If/Else conditional operator syntax [duplicate]
- MVC 3: Add usercontrol to Razor view
- Razor comment syntax
- Razor doesn’t understand unclosed html tags
- @Html.BeginForm Displaying “System.Web.Mvc.Html.MvcForm” on Page
- Display encoded html with razor
- The view must derive from WebViewPage, or WebViewPage
- Currency Formatting MVC
- Accessing a Session object from Razor _Layout.cshml
- Creating MVC3 Razor Helper like Helper.BeginForm()
- How to specify ID for an Html.LabelFor (MVC Razor) [duplicate]
- Razor reseverd words
- Using JSON.NET as the default JSON serializer in ASP.NET MVC 3 – is it possible?
- Conditional HTML Attributes using Razor MVC3
- How do I create a MVC Razor template for DisplayFor()
- Ninject Binding Attribute to Filter with Constructor Arguments
- asp.net MVC3 razor: display actionlink based on user role