to-datetime
TypeScript icon, indicating that this package has built-in type declarations

1.0.3 • Public • Published

to-datetime

Extremely simple and small module that formats a Date instance as datetime.

$ toDatetime(); // 2016-03-20 13:37:00

Installing

npm i to-datetime --save

Usage

var toDateTime = require ('to-datetime');
 
// From an instance
var date = new Date();
 
toDateTime(date);
 
// As UTC
toDateTime(date, true);
 
// From a constructor string
var dateString = new Date('2016-03-20 15:51:55');
toDateTime(dateString);
 
// Current time as datetime
toDateTime();
 
// Current time as UTC
toDateTime(null, true);

Running the tests

npm test

Package Sidebar

Install

npm i to-datetime

Weekly Downloads

1

Version

1.0.3

License

MIT

Unpacked Size

4.97 kB

Total Files

7

Last publish

Collaborators

  • rwoverdijk