js unix 时间戳 转为 普通时间

简介

RT

code

            var time = 1595058723;
            var unixTimestamp = new Date(time * 1000)
            commonTime = unixTimestamp.toLocaleString('en-GB', { hour12: false })
            var tim = commonTime.split('/')
            var year = tim[2].split(',')[0]
            var month = tim[1]
            var day = tim[0]
            var tt = tim[2].split(',')[1]
            console.log(year + '/' + month + '/' + day + tt)

Result

2020/07/18 15:52:03

Hope is a good thing,maybe the best of things,and no good thing ever dies.----------- Andy Dufresne
原文地址:https://www.cnblogs.com/eat-too-much/p/13336173.html