npm.io
1.0.0 • Published 3 years ago

my-time-bag

Licence
ISC
Version
1.0.0
Deps
0
Size
2 kB
Vulns
0
Weekly
0

安装

npm install my-time-bag

导入

const time = require('my-time-bag')

使用init()实例化对象

// 不加参数默认实例化当前时间   参数格式 xxxx-xx-xx xx:xx
let item = time.init();
// 结果  2023-02-09 17:20:58

通过实例对象获取年、时间戳

//年
item.gery()  // 2023
//时间戳
item.getms()  //不加参数得到的是实例化对象的时间戳
item.getms('2023-02-10 00:00')  //得到指定时间的时间戳

开源协议

ISC

Keywords