[Mvc DateTime正在采用MM / dd / yyyy格式,但我需要dd / mm / yyyy

问题描述 投票:0回答:1
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,
        });

请帮助我如何以dd / mm / yyyy格式记录日期enter image description here

asp.net-mvc jquery-ui-datepicker
1个回答
0
投票

从此更改日期格式:dateFormat: "dd/M/yy",

至此:dateFormat: 'dd/mm/yy'

更多信息herehere

希望这会有所帮助

© www.soinside.com 2019 - 2024. All rights reserved.