安装 silly-datetime
新建一个js文件,文件内容如下:
var sd = require('silly-datetime'); var time=sd.format(new Date(), 'YYYY-MM-DD HH:mm'); console.log(time);