Get a formatted timestamp.
Please consider following this project's author, Jon Schlinkert, and consider starring the project to show your ❤️ and support.
Install with npm:
$ npm install --save time-stamp
const timestamp = ;console;//=> 2018-10-26console;//=> 2018-10-26
Customizing the timestamp
You may also pass a string to format the generated timestamp.
console;//=> 20181026console;//=> 20181026
YYYY: full year (ex: 2018)
MM: month (ex: 04)
DD: day (ex: 01)
HH: hours (ex: 12)
mm: minutes (ex: 59)
ss: seconds (ex: 09)
ms: milliseconds (ex: 532)
console;//=> 20181026console;//=> 20181026console;//=> 20181026:24console;//=> 20181026:24console;//=> 2018/10/26:46:24console;//=> 2018/10/26:46:24console;//=> 2018:10:26console;//=> 2018:10:26console;//=> [2018:10:26]console;//=> [2018:10:26]console;//=> 2018/10/26console;//=> 2018/10/26console;//=> 2018:10console;//=> 2018:10console;//=> 2018console;//=> 2018console;//=> 10console;//=> 10console;//=> 26console;//=> 26console;//=> 00console;//=> 04console;//=> 46console;//=> 46console;//=> 24console;//=> 24console;//=> 186console;//=> 186
Default pattern was changed from
YYYY-MM-DD. See issues/3 for more details.
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.
Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:
$ npm install && npm test
To generate the readme, run the following command:
$ npm install -g verbose/verb#dev verb-generate-readme && verb
You might also be interested in these projects:
- days: Days of the week. | homepage
- iso-week: Get the ISO week of the year. | homepage
- month: Get the name or number of the current month or any month of the year. | homepage
- months: Months of the year. | homepage
- seconds: Get the number of seconds for a minute, hour, day and week. | homepage
- week: Get the current week number. | homepage
- weekday: Get the name and number of the current weekday. Or get the name of the… more | homepage
- year: Simple utility to get the current year with 2 or 4 digits. | homepage
This file was generated by verb-generate-readme, v0.8.0, on October 26, 2018.