/** * getNowFormatDate 获取当前时间 * @param msec 毫秒值 */ getNowFormatDate :function(msecVal){ if(msecVal){ var now = new Date(msecVal); //毫秒值转为完整时间 }else{ var now = new Date(); //完整时间 }; var month = now.getMonth() + 1; //当前月份 var day = now.getDate(); //当前天 var Hours = now.getHours(); //当前时 var Minutes = now.getMinutes(); //当前分 var Seconds = now.getSeconds(); //当前秒 if(month >= 1 && month <= 9){ //月 month = "0" + month; }; if(day >= 0 && day <= 9){ //日 day = "0" + day; }; if(Hours >= 0 && Hours <= 9){ //时 Hours = "0" + Hours; }; if(Minutes >= 0 && Minutes <= 9){ //分 Minutes = "0" + Minutes; }; if(Seconds >= 0 && Seconds <= 9){ //秒 Seconds = "0" + Seconds; }; var currentdate = now.getFullYear() + "-" + month + "-" + day + " " + Hours + ":" + Minutes + ":" + Seconds; return currentdate; },