为什么没有字段更改的日期格式?

时间:2018-06-11 08:09:32

标签: c# asp.net-mvc asp.net-mvc-4 date-format

我正在尝试更改绑定字段的日期格式,但它不会更改

视图模型:

        [Required (ErrorMessage="From Date is required")]
        [DataType(DataType.Date)]
        [DisplayFormat(DataFormatString = "{0:yyyy-MM-dd}", ApplyFormatInEditMode = true)]
        public DateTime FromDate { get; set; }

查看:

        @Html.EditorFor(Model => Model.FromDate, new { htmlAttributes = new { @class = "form-control searchbox-border", placeholder = "From Date" } })

0 个答案:

没有答案