1.0.1 • Published 6 years ago
@nlib/date-string v1.0.1
@nlib/date-string
Converts an integer to a human readable format.
Install
npm install @nlib/date-string
Usage
const console = require('console');
const DateString = require('@nlib/date-string');
const d = new Date(2012, 3, 4, 5, 6, 7);
const date1 = new DateString('[YYYY]-[MM]-[DD] [hh]:[mm]:[ss]');
console.log(date1(d));
// 2012-04-04 05:06:07
const date2 = new DateString('[YYYY]-[MMM]-[MMMM]-[D] [ddd] [dddd] [h]:[m]:[s]');
console.log(date2(d));
// 2012-Apr-April-4 Wed Wednesday 5:6:7
Javascript API
new DateString(format: String) → fn(...args) → String
- format: A string to format the given date-string.
- args: is passed to construct a date-string object.
LICENSE
MIT