无法使用jquery datepicker格式化日期 [英] not able to format date using jquery datepicker

查看:145
本文介绍了无法使用jquery datepicker格式化日期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在输入框上调用日期选择器.但是,无论我使用哪种格式,它始终以mm/dd/yyyy格式返回日期.我希望它返回-2011年11月30日(dd-mm-yyyy)格式.以下是我尝试的选项-

I am invoking the datepicker on an input box. However, irrespective of the format I am giving, it always returns the date in mm/dd/yyyy format. I want it to return - 30-11-2011 (dd-mm-yyyy) format. Below are the options I tried -

选项1

$("#birthdate").datepicker({
    changeYear: true,
    changeMonth: true
    dateFormat: 'yy-mm-dd'
    });

选项2

$.datepicker.formatDate('yy-mm-dd', new Date(2007, 1 - 1, 26));

我的html包括jquery-ui.js,jquery-ui-datepicker.js和jquery.js.

My html includes jquery-ui.js, jquery-ui-datepicker.js and jquery.js.

我已经提到 jQuery UI DatePicker-更改日期格式 jquery datepicker格式的日期不起作用,并尝试了所有选项,但没有一个他们为我工作.如果有人知道解决方案,请告诉我.

I have already referred to jQuery UI DatePicker - Change Date Format and Jquery datepicker format date not working and tried all the option but none of them in working for me. Please let me know if someone knows the solution.

推荐答案

这是我的评论,但作为OP的答复说这是解决方案:

This was my comment, but posting as the answer as the OP said it was the solution:

您正在加载jquery-ui和jquery-ui-datepicker?我经常使用此小部件,并且在日期格式方面没有遇到麻烦.可能同时包含这两个文件是错误的吗?

You are loading jquery-ui AND jquery-ui-datepicker? I use this widget a lot and have not had trouble with date formatting. It's possible that including both of these files is what is at fault?

这篇关于无法使用jquery datepicker格式化日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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