C# DataFormatString不';有些日子我不工作
我正在为我的一个属性使用以下属性:C# DataFormatString不';有些日子我不工作,c#,datetime,asp.net-core-mvc,model-binding,date-format,C#,Datetime,Asp.net Core Mvc,Model Binding,Date Format,我正在为我的一个属性使用以下属性: [DataType(DataType.DateTime), DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = "{0:dd/MM/yyyy}")] public DateTime? StartDate { get; set; } 正如您所看到的,我这样指定了日期格式字符串:{0:dd/MM/yyyy} 查看: <div class="form-group"> &l
[DataType(DataType.DateTime), DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = "{0:dd/MM/yyyy}")]
public DateTime? StartDate { get; set; }
正如您所看到的,我这样指定了日期格式字符串:{0:dd/MM/yyyy}
查看:
<div class="form-group">
<label asp-for="StartDate" class="col-md-2 control-label"></label>
<div class="col-md-10">
<input asp-for="StartDate" class="form-control" />
<span asp-validation-for="StartDate" class="text-danger"></span>
</div>
</div>
但是当我在服务器上发布带有以下日期的表单:17/12/2016
StartDate将为空。有什么想法吗