Fri Sep 20 2019 16:37:39 GMT+0800 (中国标准时间) 微信小程序js日期格式转换

      const d = Fri Sep 20 2019 16:37:39 GMT+0800 (中国标准时间);
      const d = res.data[0].time
      const resDate = d.getFullYear() + '-' + this.p((d.getMonth() + 1)) + '-' + this.p(d.getDate())
      const resTime = this.p(d.getHours()) + ':' + this.p(d.getMinutes()) + ':' + this.p(d.getSeconds())
      console.log(resDate);
      console.log(resTime);

 

posted @ 2019-09-26 21:08  在学习编程的lsy呀  阅读(1492)  评论(0编辑  收藏  举报