欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

Prototype Date對象 學(xué)習(xí)

 更新時間:2009年07月12日 23:07:00   作者:  
這個對象里面就一個toJSON方法,非常簡單
看一下源碼:
復(fù)制代碼 代碼如下:

Date.prototype.toJSON = function() {
return '"' + this.getUTCFullYear() + '-' +
(this.getUTCMonth() + 1).toPaddedString(2) + '-' +
this.getUTCDate().toPaddedString(2) + 'T' +
this.getUTCHours().toPaddedString(2) + ':' +
this.getUTCMinutes().toPaddedString(2) + ':' +
this.getUTCSeconds().toPaddedString(2) + 'Z"';
};

其實就是返回Date的JSON字符串,下面給出示例:
復(fù)制代碼 代碼如下:

new Date(1969, 11, 31, 19).toJSON();
//-> '"1969-12-31T19:00:00"'

相關(guān)文章

最新評論