我想使用JQuery datepicker将日期转换为dd/mm/yy格式。但我以dd/mm/yyyy结束。下面是我试过的代码 -JQuery datepicker does not return mm/dd/yy
chkIn = $.datepicker.formatDate("dd/mm/yy", cinDate); where cinDate is Thu Aug 29 2013 00:00:00 GMT+0530
chkIn
是29/08/2013
我想使用JQuery datepicker将日期转换为dd/mm/yy格式。但我以dd/mm/yyyy结束。下面是我试过的代码 -JQuery datepicker does not return mm/dd/yy
chkIn = $.datepicker.formatDate("dd/mm/yy", cinDate); where cinDate is Thu Aug 29 2013 00:00:00 GMT+0530
chkIn
是29/08/2013
Ÿ - 年(两位数)
YY - 年(四位数)
所以使用chkIn = $.datepicker.formatDate("dd/mm/y", cinDate);
你必须使用"dd/mm/y"
代替"dd/mm/yy"
chkIn = $.datepicker.formatDate("dd/mm/y", cinDate);
$ .datepicker.formatDate(格式,日期设置)
格式的日期转换为字符串值与指定的格式。
The format can be combinations of the following:
d - day of month (no leading zero)
dd - day of month (two digit)
o - day of the year (no leading zeros)
oo - day of the year (three digit)
D - day name short
DD - day name long
m - month of year (no leading zero)
mm - month of year (two digit)
M - month name short
MM - month name long
y - year (two digit)
yy - year (four digit)
@ - Unix timestamp (ms since 01/01/1970)
! - Windows ticks (100ns since 01/01/0001)
'...' - literal text
'' - single quote
anything else - literal text
我想,你的代码必须工作:
var cinDate = new Date(); // it must be a date object
var current_date = $.datepicker.formatDate('dd/mm/yy', cinDate);
这对我的作品。