JS去除日期date格式化中的T和Z

Terwer...小于 1 分钟实用技巧经验分享jsdateformat

JS去除日期date格式化中的T和Z

代码如下

const formatDate = (dt) => {
  if (!dt) {
    return "";
  }
  let newdt = dt.replace(/T/g, ' ')
  return newdt.substr(0, newdt.lastIndexOf('.'));
}
评论
  • 按正序
  • 按倒序
  • 按热度
Powered by Waline v2.14.9