I have the following model property and attribute:
[DataType(DataType.Date)]
public Nullable<DateTime> DateOfBirth { get; set; }
My EditScreen.cshtml has the following part to display the date of birth:
<div class="editor-label">
Date of Birth
</div>
<div class="editor-field">
@Html.EditorFor(model => model.DateOfBirth)
@Html.ValidationMessageFor(model => model.DateOfBirth)
</div>
However, despite the DataType.Date attribute, the full date and time are displayed on the page, e.g. 06/04/1971 00:00:00
Why is the time part of the date still being displayed, are there any 'gotchas' that I've missed?
I've tried changing Nullable to date time but doesn't make any difference. There must be something fundamental which is preventing the date being formatted, but I have no idea what that might be, and no idea how to find out.