SOURCE

//function formatDate (value) {
formatDate = (value) => {
    if (typeof (value) == 'undefined') {
        return ''
    } else {
        let date = new Date(parseInt(value))
        let y = date.getFullYear()
        let MM = date.getMonth() + 1
        MM = MM < 10 ? ('0' + MM) : MM
        let d = date.getDate()
        d = d < 10 ? ('0' + d) : d
        let h = date.getHours() //钉钉接口里面存的其实是格林尼治时间戳,转换成东八区时间要+8
        h = h < 10 ? ('0' + h) : h
        let m = date.getMinutes()
        m = m < 10 ? ('0' + m) : m
        let s = date.getSeconds()
        s = s < 10 ? ('0' + s) : s
        //return y + '-' + MM + '-' + d + ' ' + h + ':' + m + ':' + s
        console.log(y + '-' + MM + '-' + d + ' ' + h + ':' + m + ':' + s);
    }
}
formatDate('1664930918000');
console 命令行工具 X clear

                    
>
console