拿到2018-08-06T10:00:00.000Z 這種時間格式 怎么轉(zhuǎn)換為本地時間 就是類似2018-08-06 18:00:00
1 回答

慕工程0101907
TA貢獻1887條經(jīng)驗 獲得超5個贊
先用著:
var date = new Date('2018-08-06T10:00:00.000Z')function formatDate(date) { var year = date.getFullYear() var month = format(date.getMonth() + 1) var da = format(date.getDate()) var h = format(date.getHours()) var m = format(date.getMinutes()) var s = format(date.getSeconds()) return year + '-' + month + '-' + da + ' ' + h + ':' + m + ':' + s }function format(val) { return Number(val) < 10 ? '0' + val : '' + val } console.log(formatDate(date))
添加回答
舉報
0/150
提交
取消