public class Employee{
[DataType(DataType.Date)]
public DateTime DateOfRegistration { get; set; }
}
我的.cshtml
@Html.EditorFor(model => model.DateOfRegistration, new { htmlAttributes = new { @class = "form-control", @readonly = "true" } })
Jquery代码
$('input[type=datetime]').datepicker({
dateFormat: "dd/M/yy",
changeMonth: true,
changeYear: true,
});