zoukankan      html  css  js  c++  java
  • js将 “2021-07-06T06:23:57.000+00:00” 转换为年月日时分秒

    //将“2021-07-06T06:23:57.000+00:00” ,转换为2021-07-06 14:23
    let orderTime = "2021-07-06T06:23:57.000+00:00";
    console.log( this.transformTimestamp(orderTime) ); //输出2021-07-06 14:23





    //
    时间转换 transformTimestamp(timestamp){ let a = new Date(timestamp).getTime(); const date = new Date(a); const Y = date.getFullYear() + '-'; const M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-'; const D = (date.getDate() < 10 ? '0'+date.getDate() : date.getDate()) + ' '; const h = (date.getHours() < 10 ? '0'+date.getHours() : date.getHours()) + ':'; const m = (date.getMinutes() <10 ? '0'+date.getMinutes() : date.getMinutes()) ; // const s = date.getSeconds(); // 秒 const dateString = Y + M + D + h + m; // console.log('dateString', dateString); // > dateString 2021-07-06 14:23 return dateString; },
  • 相关阅读:
    java坏境内存不够用 大量占用swap 临时加swap
    磁盘分区
    简述raid0,raid1,raid5,raid10 的工作原理及特点
    给用户提权
    用户的环境变量被删除了
    定时任务
    linux权限
    kafka部署
    数据仓库
    kylin
  • 原文地址:https://www.cnblogs.com/dreamstartplace/p/14977052.html
Copyright © 2011-2022 走看看