Js timeStamp时间戳转换

    getdate(lTimeStamp) {
      // var now = new Date(),
      var now = new Date(lTimeStamp);

        let y = now.getFullYear(),
        m = now.getMonth() + 1,
        d = now.getDate();
      return y + "-" + (m < 10 ? "0" + m : m) + "-" + (d < 10 ? "0" + d : d) + " " + now.toTimeString().substr(0, 8);
    }
posted @ 2021-12-23 08:38  寒冷的雨呢  阅读(83)  评论(0编辑  收藏  举报