您可以使用属于您的 Date 对象 dayClick 的 formatDate 函数!
function getGMTOffset(localDate) {
var positive = (localDate.getTimezoneOffset() > 0);
var aoff = Math.abs(localDate.getTimezoneOffset());
var hours = Math.floor(aoff / 60);
var mins = aoff % 60;
var offsetTz = padzero_(hours) + ':' + padzero_(mins);
// getTimezoneOffset() method returns difference between (GMT) and local time, in minutes.
// example, If your time zone is GMT+2, -120 will be returned.
// This is why we are inverting sign
if (!positive) {
return '+' + offsetTz;
}
return '-' + offsetTz;
}
function pad2zeros(n) {
if (n < 100) {
n = '0' + n;
}
if (n < 10) {
n = '0' + n;
}
return n;
}
function padzero(n) {
return n < 10 ? '0' + n : n.toString();
}
function formatDate(date) {
if (date) {
return (date.getFullYear()) +
'-' + padzero((date.getMonth() + 1)) +
'-' + padzero(date.getDate()) +
'T' + padzero(date.getHours()) +
':' + padzero(date.getMinutes()) +
':' + padzero(date.getSeconds()) +
'.' + pad2zeros(date.getMilliseconds()) +
getGMTOffset(date);
}
return '';
}