Date.prototype.toISOString方法是在ES5裡添加的,ES3文檔中沒有,如下
這個方法在IE6/7/8中不支持,可按下面方式修正下
if (!Date.prototype.
Date.prototype.toISOString = function() {
function pad(n) { return n return this.getUTCFullYear() '-'
pad (this.getUTCMonth() 1) '-'
pad(this.getUTCDate()) 'T'
pad(this.getUTCHours()) ':'
pad(this.getUTCMinutes()) ':'
pad(this.getUTCSeconds()) '.'
pad(this.getUTCMilliseconds()) 'Z';
}
}
相關:
http://msdn.microsoft.com/zh-cn/library/ie/ff925953(v=vs.94).aspx
https://developer.mozilla.org/en-US/docs /Web/JavaScript/Reference/Global_Objects/Date