var dataArray = []; var regExp = new RegExp(/(\d{4})(\d{2})(\d{2})/); var weekTime = dojo.map(data,function(item,index){regExp.test(item.exchange_date);return RegExp.$1 + "-" + RegExp.$2 + "-" + RegExp.$3;}); console.log(weekTime); dojo实现
var dataArray = []; var regExp = new RegExp(/(\d{4})(\d{2})(\d{2})/); var weekTime = dojo.map(data,function(item,index){ regExp.test(item.exchange_date); return RegExp.$1 + "-" + RegExp.$2 + "-" + RegExp.$3; }); console.log(weekTime);dojo实现例如将20130222转换成2013-02-22