处理时间戳转换为 年-月-日 时:分:秒

formDate(date) {
    
    
                                const dt = new Date(date * 1000)
                                const y = dt.getFullYear()
                                const m = (dt.getMonth() + 1 + '').padStart(2, '0')
                                const d = (dt.getDate() + '').padStart(2, '0')
                                const hh = (dt.getHours() + '').padStart(2, '0')
                                const mm = (dt.getMinutes() + '').padStart(2, '0')
                                const ss = (dt.getSeconds() + '').padStart(2, '0')

                                return `${
    
    y}-${
    
    m}-${
    
    d} ${
    
    hh}:${
    
    mm}:${
    
    ss}`
                        }

猜你喜欢

转载自blog.csdn.net/qq_45894929/article/details/110927750
今日推荐