<%: Html.EditorFor(model => model.Item.Date) %>
And in your view model:
[DataType(DataType.Time)] [DisplayFormatAttribute(ApplyFormatInEditMode = true, DataFormatString = "{0:d}")] public DateTime Date { get; set; }
UPDATE:
Full example:
Model:
public class MyModel { public Item Item { get; set; } } public class Item { [DataType(DataType.Time)] [DisplayFormatAttribute(ApplyFormatInEditMode = true, DataFormatString = "{0:d}")] public DateTime Date { get; set; } }
Controller:
public class HomeController : Controller { public ActionResult Index() { return View(new MyModel { Item = new Item { Date = DateTime.Now } }); } }
View:
<%: Html.EditorFor(model => model.Item.Date) %>
source share