function getDate(timeData,style) { //timeData 为时间戳 style为年月日中间拼接的样式 var time = new Date(timeData * 1000); var time = time.toLocaleDateString().replace(/d+/g,function (a,b) { if(a.length == 1){ var a = '0'+a } return a }); return time.replace(///g,style||'-') };