标签:replace erro time const cat ret pre $1 其他
changeTime (val) {
const pattern = /^(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})$/
try {
return val.replace(pattern, ‘$1-$2-$3 $4:$5:$6‘)
} catch (error) {
return ‘--‘
}
}
YYYYMMDDhhmmss转换成YYYY-MM-DD hh:mm:ss 或其他样式
标签:replace erro time const cat ret pre $1 其他
原文地址:https://www.cnblogs.com/nixu/p/14963356.html