var formatNumber = function (n) { n = n.toString() return n[1] ? n : '0' + n } /** * 将时间戳(1570550400)格式转为 yyyy-MM-dd格式 */ var formatDate = function (datetime) { var time = datetime * 1 var date = getDate(time); var year = date.getFullYear(); var month = date.getMonth() + 1; var day = date.getDate(); return year + '年' + month + '月' + day + '日'; } module.exports = { formatDate: formatDate }