js 日期2015/12/22/16/45替换2015-12-22 16:45格式
利用正则分组:
function toChange(date) {
var reg = /(d+)/(d+)/(d+)/(d+)/(d+)/g;
return date.replace(reg, "$1-$2-$3 $4:$5");
}
var dataStr='2015/12/22/16/45';
console.log(toChange(dataStr));
利用正则分组:
var dataStr='2015/12/22/16/45';
console.log(toChange(dataStr));