/**
   * UTCformat 转换UTC时间并格式化成本地时间
   * @param {string} utc
   */
  UTCformat (utc) {
    var date = new Date(utc),
        y = date.getFullYear(),
        month = date.getMonth()+1 > 9 ? date.getMonth()+1 : '0' + parseInt(date.getMonth()+1),
        day = date.getDate() > 9 ? date.getDate() : '0' + date.getDate(),
        h =  date.getHours() > 9 ? date.getHours() : '0' + date.getHours(),
        m = date.getMinutes() > 9 ? date.getMinutes() : '0' + date.getMinutes(),
        s = date.getSeconds() > 9 ? date.getSeconds() : '0' + date.getSeconds();
    var res = y + '-' + month + '-' + day + ' ' + h + ':' + m;
    return res;
  }
}

 

相关文章:

  • 2022-12-23
  • 2022-01-17
  • 2021-07-21
  • 2021-11-21
  • 2021-06-07
  • 2021-09-08
  • 2022-12-23
猜你喜欢
  • 2021-10-25
  • 2022-12-23
  • 2022-12-23
  • 2021-12-05
  • 2022-12-23
  • 2021-07-06
  • 2022-02-03
相关资源
相似解决方案