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);
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);