最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

javascript日期轉(zhuǎn)換 時間戳轉(zhuǎn)日期格式

 更新時間:2011年11月05日 15:09:58   作者:  
javascript日期轉(zhuǎn)換 時間戳轉(zhuǎn)日期格式實現(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 testDate = new Date( 1320336000000 );//這里必須是整數(shù),毫秒
var testStr = testDate.format("yyyy年MM月dd日hh小時mm分ss秒");
var testStr2 = testDate.format("yyyyMMdd hh:mm:ss");
alert(testStr + " " + testStr2);

相關(guān)文章

最新評論

鹤壁市| 策勒县| 贵德县| 张家港市| 遵义县| 白朗县| 岐山县| 海晏县| 峨山| 富源县| 弥勒县| 垫江县| 盐亭县| 蛟河市| 隆子县| 壤塘县| 团风县| 兴城市| 叙永县| 新巴尔虎右旗| 曲阜市| 北安市| 织金县| 汤原县| 忻城县| 井冈山市| 北票市| 霞浦县| 遂宁市| 海淀区| 滨海县| 高雄市| 保德县| 台山市| 九龙县| 武强县| 临安市| 肥东县| 乐山市| 南部县| 阿坝县|