标签:
var dateString = "20151208180700"; var pattern = /(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/; var formatedDate = dateString.replace(pattern, ‘$1-$2-$3 $4:$5:$6‘); alert(formatedDate); console.log(formatedDate);
js把字符串(yyyymmdd)格式转换成日期格式(yyyy-mm-dd)
标签:
原文地址:http://www.cnblogs.com/mchuang/p/5029930.html