获取当前时间年月日

getNowDate() {
    let date = new Date();
    let y = date.getFullYear();
    let m = date.getMonth() + 1;
    let d = date.getDate();
    let H = date.getHours();
    let mm = date.getMinutes();
    let s=date.getSeconds()
    m = m < 10 ? "0" + m : m;
    d = d < 10 ? "0" + d : d;
    H = H < 10 ? "0" + H : H;
    return y + "-" + m + "-" + d + " " + H + ":" + mm+":"+s;
},

 

posted @ 2020-09-17 15:41  郑正正  阅读(252)  评论(0编辑  收藏  举报
Live2D