ytodate
v1.0.5
Published
``` let toDate = require('ytodate') toDate(); // Sun 11 Aug 10:14PM (current time) ```
Downloads
30
Readme
About
let toDate = require('ytodate')
toDate(); // Sun 11 Aug 10:14PM (current time)
let ts = Date.now()
toDate(ts); // Sun 11 Aug 10:14PM
toDate(ts, {minute: 0}) // Sun 11 Aug 10PM
toDate(ts, {year: 1, second: 1}) // 2024 Sun 11 Aug 10:21:15PM (full)
Parameters
All parameters are optional: 0 to disable, 1 to enable
toDate(ts, { [year/y], [month/mo/M], [date/d], [day/D], [hour/h], [minutes/m], [second/s] });
toDate(ts, { year: 0, month: 1, date: 1, day: 1, hour: 1, minute: 1, second: 0 }); // Sun 11 Aug 10:14PM (default)
toDate(ts, { year: 1, month: 1, date: 1, day: 1, hour: 1, minute: 1, second: 1 }); // 2024 Sun 11 Aug 10:21:15PM (full)
eg2 (1st param can be omitted)
toDate({t:Date.now()}); // Sun 11 Aug 10:14PM
toDate({m: 0}) // Sun 11 Aug 10PM
toDate({y: 1, s: 1}) // 2024 Sun 11 Aug 10:21:15PM (full)
Parameters
All parameters are optional: 0 to disable, 1 to enable
toDate({ [timestamp/time/ts/t], [year/y], [month/mo/M], [date/d], [day/D], [hour/h], [minutes/m], [second/s] });
toDate({ timestamp: Date.now(), year: 0, month: 1, date: 1, day: 1, hour: 1, minute: 1, second: 0 }); // Sun 11 Aug 10:14PM (default)