function getUTCISODateString(d){
function pad(n){return n<10 ? '0'+n : n};
function threePad(n){return n<10 ? '00'+n : (n < 100 ? '0' + n : n)};
return d.getUTCFullYear()+'-'
+ pad(d.getUTCMonth()+1)+'-'
+ pad(d.getUTCDate())+'T'
+ pad(d.getUTCHours())+':'
+ pad(d.getUTCMinutes())+':'
+ pad(d.getUTCSeconds())+ '.'
+ threePad(d.getUTCSeconds()) + 'Z';
}
now_utc.toJSON()
最後に、
var now = new Date();
var now_utc = new Date(now.getUTCFullYear(), now.getUTCMonth(), now.getUTCDate(), now.getUTCHours(), now.getUTCMinutes(), now.getUTCSeconds());
alert(now_utc.toJSON());
チェック:
「新しい日付()」を意味しましたか?これは、Dateオブジェクトのすべてのプロパティを含む現在の日付を返す(new Date())。toJSON()は動作するはずです –
私の質問は2013-08-31T9:4:51.859 Z in js –
新しい日付()。toJSON()が返す2013-08-31T09:04:51.863Z –