I have this attribute in my view model:
[DataType(DataType.DateTime)]
public DateTime? StartDate { get; set; }
If I want to display the dat
If your data field is already a DateTime datatype, you don't need to use [DataType(DataType.Date)] for the annotation; just use:
[DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = "{0:MM/dd/yyyy}")]
on the jQuery, use datepicker for you calendar
$(document).ready(function () {
$('#StartDate').datepicker();
});
on your HTML, use EditorFor helper:
@Html.EditorFor(model => model.StartDate)