//如果是求当前时间只需去掉time形参即可,time 为时间戳;
function getNowDate(time){
var nowDate -new date(time);
var month = putZero(nowDate.getMonth()+1),
day = putZero(nowDate.getDate()),
hour = putZero(nowDate.getHours()),
min = putZero(nowDate.getMinutes()),
sec= putZero(nowDate.getSeconds());
return nowDate.getFullYear()+'-'+month+'-'+day+' '+hour+':'+min+':'+sec;
}
//为个位数加0
function putZero(num){
return num<10?'0'+num:num;
}