wanshengwei
v1.0.0
Published
格式化时间的包
Downloads
3
Readme
安装
npm i bagba
引入
const dataformat = require('bagba');
格式化时间分使用
function format(){
const dt = new Date();
const y = dt.getFullYear();
const m = dt.getMonth()+1;
const d = dt.getDate();
const h = dt.getHours();
const c = dt.getMinutes();
const s = dt.getSeconds();
return `${y}-${m}-${d}-${h}-${c}-${s}`
}
function zero(n){
return n < 10 ? '0' + n : n;
}
module.exports = {
format
}
开源许可协议 ISC