亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

JS如何將UTC格式時(shí)間轉(zhuǎn)本地格式

 更新時(shí)間:2013年09月04日 17:37:19   作者:  
UTC格式時(shí)間想必大家并不陌生,那么怎么可以將其轉(zhuǎn)換為本地格式呢?其實(shí)很簡(jiǎn)單,下面的方法會(huì)幫助大家實(shí)現(xiàn)這一想法
復(fù)制代碼 代碼如下:

Date.prototype.format = function (format) {
var o = {
"M+": this.getMonth() + 1, //month
"d+": this.getDate(), //day
"h+": this.getHours(), //hour
"m+": this.getMinutes(), //minute
"s+": this.getSeconds(), //second
"q+": Math.floor((this.getMonth() + 3) / 3), //quarter
"S": this.getMilliseconds() //millisecond
}
if (/(y+)/.test(format)) format = format.replace(RegExp.$1,
(this.getFullYear() + "").substr(4 - RegExp.$1.length));
for (var k in o) if (new RegExp("(" + k + ")").test(format))
format = format.replace(RegExp.$1,
RegExp.$1.length == 1 ? o[k] :
("00" + o[k]).substr(("" + o[k]).length));
return format;
}

var TempDate = new Date();

TempDate.toLocaleDateString()//2013年9月4日

TempDate.format("yyyy-MM-dd")//2013-09-04

相關(guān)文章

最新評(píng)論