i have a DateTime Field that must be shown in Edit view
@Html.EditorFor( model => model.StartDate )
how can i use somthing like this ; <
Use the [DisplayFormat] attribute on your view model:
public class MyViewModel
{
[DisplayFormat(DataFormatString = "{0:d}", ApplyFormatInEditMode = true)]
public DateTime StartDate { get; set; }
...
}
and then in your view simply:
@model MyViewModel
...
@Html.EditorFor(model => model.StartDate)