标签:function const content dsd 获取 UNC fun dsa 时间格式
const list = ‘ddsadsd2012-02-09 19:00‘
for (let i = 0; i < list.length; i++) {
let str = list[i].workContent
console.log(‘str‘,str)
let datetime = [], date;
str.replace(/((\d{4}(-\d{1,2}){2}).{2})?(\d{1,2}(:\d{1,2}){2})/g, function ($0, $1, $2, $3, $4) {
if ($2 && $2 !== date) date = $2;
datetime.push($1+$4);
})
list[i].time=datetime[0]?datetime[0]:‘‘
console.log(‘time‘,datetime.join(‘\n‘))
}
标签:function const content dsd 获取 UNC fun dsa 时间格式
原文地址:https://www.cnblogs.com/ITtt/p/12291626.html