var moment = require(‘moment‘); moment.locale(‘zh-cn‘); var today = {}; var _today = moment(); today.year = _today.format(‘yyyy‘); /*现在的年*/ today.date = _today.format(‘YYYY-MM-DD‘); /*现在的时间*/ today.yesterday = _today.subtract(1, ‘days‘).format(‘YYYY-MM-DD‘); /*前一天的时间*/ var formatDate = moment(12345678977).format(‘YYYY-MM-DD HH:mm:ss‘); /*格式化时间*/
时间: 2024-10-23 07:00:22