标签:转换 att ring 写法 日期格式 class 字符 ace ted
1、第一种写法:
var r="20112233".replace(/^(\d{4})(\d{2})(\d{2})$/, "$1-$2-$3")
2、第二种写法:
var dateString = ‘19930701‘; var pattern = /(\d{4})(\d{2})(\d{2})/; var formatedDate = dateString.replace(pattern, ‘$1-$2-$3‘);
js把字符串(yyyymmdd)转换成日期格式(yyyy-mm-dd)
标签:转换 att ring 写法 日期格式 class 字符 ace ted
原文地址:https://www.cnblogs.com/mentiantian/p/10333804.html