1.1.1 • Published 6 years ago

date2json v1.1.1

Weekly downloads
4
License
MIT
Repository
github
Last release
6 years ago

date2json

Build Status npm version npm

Parse Date to Json in JavaScript

Usage

npm i date2json --save
date2json() // Get current time
date2json(new Date()) // Equal to the first one
date2json(new Date(1518545575000)) // Put Date object in the function to get that time
const date2json = require("date2json");

const currentTime = date2json();
console.log(currentTime);
// Local time in string JSON format
// {
//   "year": "YYYY",
//   "month": "MM",
//   "day": "DD",
//   "hour": "HH",
//   "minute": "mm",
//   "second": "SS"
// }

const otherTime = date2json(new Date(1518545575000));
console.log(otherTime);
// Local time with the epoch in string JSON format
// {
//   "year": "2018",
//   "month": "02",
//   "day": "14",
//   "hour": "02",
//   "minute": "12",
//   "second": "55"
// }

License

MIT

1.1.1

6 years ago

1.1.0

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago

0.0.4

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago

0.0.0

6 years ago