ASP.Net MVC jQuery UI DatePicker日期格式 [英] ASP.Net MVC jQuery UI DatePicker Date Format

查看:166
本文介绍了ASP.Net MVC jQuery UI DatePicker日期格式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的智慧终点试图强制这个jQuery datepicker控件来了解具体的日期格式。这是怎么回事?



查看

  @Html .TextBoxFor(model => model.StartDate,{0:dd / MM / yyyy},new {@class =datefield})

Javascript

  $(function(){
$( .datefield)。datepicker({
dateFormat:'dd / MM / yyyy',
showOn:button
});
});

页面加载





datepicker点击,到目前为止这么好



日期选择...什么?



解决方案

根据文档




  • dd - 月份(两位数)

  • MM - 月名长

  • yy - 年(四位数)



所以 dd / MM / yyyy 应该产生该结果。 (日期,长月份名称和4位数年份两次。)要匹配您最初加载的格式,您需要:

  dd / mm / yy 


I'm at my wits end trying to force this jQuery datepicker control to understand specific date formats. What the hell is going on here?

View

@Html.TextBoxFor(model => model.StartDate, "{0:dd/MM/yyyy}", new { @class = "datefield" })

Javascript

$(function () {
    $(".datefield").datepicker({
        dateFormat: 'dd/MM/yyyy',
        showOn: "button"
    });
});

On page load

datepicker clicked, so far so good

date selected... what?

解决方案

According to the documentation:

  • dd - day of month (two digit)
  • MM - month name long
  • yy - year (four digit)

So dd/MM/yyyy should produce that result. (The day, the long month name, and the 4-digit year twice.) To match your initially loaded format, you'd want this:

dd/mm/yy

这篇关于ASP.Net MVC jQuery UI DatePicker日期格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆