MVC 4, C#.
In my razor view I have:
@Html.EditorFor(model => model.ActionObject.StartDate)
Which is annotated in my model with:
[DataType(DataType.Date)]
[DisplayFormat(DataFormatString = "{0:yyyy-MM-dd}", ApplyFormatInEditMode = true)]
public System.DateTime? StartDate { get; set; }
In the view, it is set like so, with date picker:
Notice how it is mm/dd/yyyy. How can I change this dynamically based on the user? The user can set there culture to whatever they want.
Normally I can do:
.ToString("d", culture)
Where culture is set dynamically. But this doesn't work for @Html.Editfor.