Asp.net mvc 4 Twitter引导数据采集器格式化问题

Asp.net mvc 4 Twitter引导数据采集器格式化问题,asp.net-mvc-4,twitter-bootstrap,jquery-ui-datepicker,datepicker,Asp.net Mvc 4,Twitter Bootstrap,Jquery Ui Datepicker,Datepicker,我正在mvc4应用程序中使用twitter boostrap datepicker。在我的模型中,我将日期属性设置为- [DisplayName("Date Last Modified")] [DisplayFormat(DataFormatString = "{0:dd/MMM/yyyy}")] public DateTime? EmpLastModified { get; set; } Jquery日期选择器如下所示- @if (Model.HasValue && (

我正在mvc4应用程序中使用twitter boostrap datepicker。在我的模型中,我将日期属性设置为-

 [DisplayName("Date Last Modified")]
 [DisplayFormat(DataFormatString = "{0:dd/MMM/yyyy}")]
 public DateTime? EmpLastModified { get; set; }
Jquery日期选择器如下所示-

@if (Model.HasValue && ((DateTime)Model.Value).Year > 1500)
{
   @Html.TextBox("", String.Format("{0:dd/MMM/yyyy }", Model.Value), new { @class =      "textbox", @style = "width:125px;" })
}
else {
@Html.TextBox("", String.Format("{0:dd/MMM/yyyy}", DateTime.Now), new { @class =   "textbox", @style = "width:125px;" })
}

<script type="text/javascript">
$(document).ready(function () {

    $("#@id").datepicker
        ({
            dateFormat: '0:dd/MMM/yyyy',
            showStatus: true,
            showWeeks: true,
            highlightWeek: true,
            changeMonth: true,
            changeYear: true,
            numberOfMonths: 1,
            showAnim: "scale",
            showOptions: {
                origin: ["top", "left"]
            }
        });
    });
@if(Model.HasValue&((DateTime)Model.Value).Year>1500)
{
@Html.TextBox(“,String.Format(“{0:dd/MMM/yyyy}”,Model.Value),新的{@class=“TextBox”,@style=“width:125px;”)
}
否则{
@Html.TextBox(“,String.Format(“{0:dd/MMM/yyyy}”,DateTime.Now),新的{@class=“TextBox”,@style=“width:125px;”)
}
$(文档).ready(函数(){
$(“#@id”).datepicker
({
日期格式:“0:dd/MMM/yyyy”,
showStatus:true,
《秀周》:没错,
《光明周刊》:没错,
变化月:对,
变化年:是的,
月数:1,
showAnim:“规模”,
展示选项:{
原点:[“顶部”、“左侧”]
}
});
});

日期选择器应将2013年5月23日显示为日期,但它显示的是2013年11月23日,而在firebug中显示的是

<input id="EmpDateAdded" class="textbox" type="text" value="23-May-2013" style="width:125px;" name="EmpDateAdded" data-val-date="The field Date Added To System must be a date." data-val="true">

我使用datepicker.css和bootstrap-datepicker.js,date.format.js


请帮忙。提前感谢

日期选择器的格式字符串与.NET不同。假设您使用的是,将其用作日期选择器的格式指南(摘自文档):


我建议您使用moment.js
如果您能够在工作中使用任何库。

非常感谢……这就是重点……我需要更改bootstrap-datepicker.js中的日期格式
Default: 'mm/dd/yyyy'

The date format, combination of d, dd, D, DD, m, mm, M, MM, yy, yyyy.

d, dd: Numeric date, no leading zero and leading zero, respectively. Eg, 5, 05.
D, DD: Abbreviated and full weekday names, respectively. Eg, Mon, Monday.
m, mm: Numeric month, no leading zero and leading zero, respectively. Eg, 7, 07.
M, MM: Abbreviated and full month names, respectively. Eg, Jan, January
yy, yyyy: 2- and 4-digit years, respectively. Eg, 12, 2012.