我想使用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);
這對我的作品。