时间格式化函数
function getNow() { var tempDate = new Date(Date.now()); var year = tempDate.getFullYear(); var month = tempDate.getMonth() + 1; if(month < 10){ month = 0 + month.toString(); } var day = tempDate.getDate(); if(day < 10){ day = 0 + day.toString(); } var hour = tempDate.getHours(); if(hour < 10){ hour = 0 + hour.toString(); } var minute = tempDate.getMinutes(); if(minute < 10){ minute = 0 + minute.toString(); } var seconds = tempDate.getSeconds(); if(seconds < 10){ seconds = 0 + seconds.toString(); } return `${year}-${month}-${day} ${hour}:${minute}:${seconds}`; } module.exports.getNow = getNow;