問(wèn)題描述 :將時(shí)間戳轉(zhuǎn)換成 12月2日 11:55-11:56 這種格式(時(shí)間戳:1543722948000 ,1543722986000)
1 回答
哆啦的時(shí)光機(jī)
TA貢獻(xiàn)1779條經(jīng)驗(yàn) 獲得超6個(gè)贊
function addZero (str) {
str = '' + str;
if (str.length < 2) return '0' + str;
else return str;
}
var date = new Date(1543722948000);
var str = addZero(date.getMonth() + 1) + '月' + addZero(date.getDate()) + '日 ' + addZero(date.getHours()) + ':' + addZero(date.getMinutes());
console.log(str);- 1 回答
- 0 關(guān)注
- 879 瀏覽
添加回答
舉報(bào)
0/150
提交
取消
