I keep having this issue trying to get the right dateformat.
I would like for it to be in the (dd/MM/yyyy) format instead.
Here is my Razor viewcode:
<div class="form-group" id="divtwo">
@Html.LabelFor(model => model.EndDate, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.EndDate, "{0:dd/MM/yyyy}", new { htmlAttributes = new { @class = "form-control" ,@id = "endDate" } })
@Html.ValidationMessageFor(model => model.EndDate, "", new { @class = "text-danger" })
</div>
</div>
Model
[DisplayFormat(DataFormatString = "{0:dd/MM/yyyy}", ApplyFormatInEditMode = true)]
[DataType(DataType.Date)]
public DateTime? EndDate { get; set; }
I have also tried setting Globalization tag in web.config, didn't help either. Can you guys give me a hint in the right direction?