InvalidCastException:无法将类型为“System.DateTimeOffset”的对象强制转换为“System.String”类型

时间:2016-08-17 20:34:16

标签: razor asp.net-core asp.net-core-mvc

    <input asp-for="Created" class="form-control" />

    [Bind("ID,Author,Created,Image")]

    [DataType(DataType.DateTime)]
    [DisplayFormat(DataFormatString = "{0:dd MMMM yyyy}", ApplyFormatInEditMode = false)]
    public DateTimeOffset Created { get; set; }

当我删除Bind It有效。空字符串也是有效的。我尝试添加input type =“text”并格式化datetime

0 个答案:

没有答案