node 取时间

通过js原生的写法,会很麻烦,通过现成的模块会方便很多

安装 silly-datetime

npm install silly-datetime --save

使用

var sd = require('silly-datetime');
var time=sd.format(new Date(), 'YYYY-MM-DD HH:mm:ss');
console.log(time);

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注




Enter Captcha Here :