比如"2016-06-06 12:05:35"變成"20160606120535"??
replace去掉-空白和:不就行了
var s='2016-06-06 12:05:35'
s=s.replace(/[- :]/g,'')
日期對象要調用api,然後格式化下
function addZero(v){if(v<10)return '0'+v;return v.toString()}
var d = new Date();
var s = d.getFullYear().toString() + addZero(d.getMonth() + 1) + addZero(d.getDate()) + addZero(d.getHours()) + addZero(d.getMinutes()) + addZero(d.getSeconds());
alert(s)