DateBox的dateFormat选项不起作用? [英] dateFormat option for DateBox does not work?
问题描述
我正在尝试使jtsage的jQuery-mobile DateBox插件的dateFormat
选项正常工作.我在HTML文档中有以下代码:
I am trying to get the dateFormat
option of jtsage's jQuery-mobile DateBox plug-in to work. I have the following code in an HTML document:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.1.0/jquery.mobile-1.1.0.min.css" />
<link rel="stylesheet" type="text/css" href="http://dev.jtsage.com/cdn/datebox/latest/jqm-datebox.min.css" />
<script src="http://code.jquery.com/jquery-1.7.2.min.js"></script>
<script src="http://code.jquery.com/mobile/1.1.0/jquery.mobile-1.1.0.min.js"></script>
<script src="http://dev.jtsage.com/cdn/datebox/latest/jqm-datebox.core.min.js"></script>
<script src="http://dev.jtsage.com/cdn/datebox/latest/jqm-datebox.mode.calbox.min.js"></script>
<script src="http://dev.jtsage.com/cdn/datebox/i18n/jquery.mobile.datebox.i18n.en_US.utf8.js"></script>
</head>
<body>
<div data-role="page">
<input type="date" name="date" data-role="datebox" data-options='{"mode":"calbox","dateFormat":"%b %d"}' />
</div>
</body>
</html>
我的问题有两个部分:
-
dateFormat
的值基于此页面: http://dev.jtsage.com/jQM-DateBox/demos/api/dateformat.html .我希望选择一个日期,它会显示在dateFormat
中,即1月2日,3月29日等.这是否正确,还是应该以其他方式使用?使用此代码,选择日期的格式为1/2/2012、3/29/2012等.
The value of
dateFormat
is based on this page: http://dev.jtsage.com/jQM-DateBox/demos/api/dateformat.html. I am expecting to choose a date, and it would be displayed in thedateFormat
, i.e. Jan 2, Mar 29, etc. Is this correct, or is it supposed to be used differently? With this code, selecting a date results in a format like 1/2/2012, 3/29/2012, etc.
我们存储在数据库中的值与希望日期选择器显示的值不同,即2012-01-02 => Jan 2,Jan 2 => 2012-01-02.这可能吗?
The value we are storing in the database vs. what we want the date picker to display is different, i.e. 2012-01-02 => Jan 2, Jan 2 => 2012-01-02. Is this possible?
谢谢.
推荐答案
http://jsfiddle.net/PGFxZ /3/在这个小提琴中,将您的日期格式更改为'%b/%d',您将获得像jan/01 .... etc.这样的日期格式.
http://jsfiddle.net/PGFxZ/3/ in this fiddle change your dateformat to '%b/%d', you will get the date format like this jan/01....etc..
这篇关于DateBox的dateFormat选项不起作用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!