tpbag
v1.0.0
Published
格式化时间日期,还转义符
Downloads
3
Readme
安装
npm install tpbag
引入
require('./tpbag')
使用
// 格式化时间
function format(){
const dt = new Date();
const y = dt.getFullYear();
const m = zero(dt.getMonth()+1);
const d = zero(dt.getDate());
return `${y}-${m}-${d}`;
}
function zero(n){
return n < 10 ? '0' + n : n
}