方法

var dateStr = '20180418230102';
var reg = /(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/;
dateStr = dateStr.replace(reg, '$1-$2-$3 $4:$5:$6');
"2018-04-18 23:01:02"
最后修改:2021 年 11 月 10 日
如果觉得我的文章对你有用,请点个赞支持一下