{"id":13605841,"url":"https://github.com/jonschlinkert/time-stamp","last_synced_at":"2025-04-13T04:09:20.562Z","repository":{"id":31333331,"uuid":"34895918","full_name":"jonschlinkert/time-stamp","owner":"jonschlinkert","description":"Get a formatted timestamp. Used in gulp, assemble, generate, and many others.","archived":false,"fork":false,"pushed_at":"2020-11-24T06:02:18.000Z","size":35,"stargazers_count":111,"open_issues_count":8,"forks_count":17,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-04-13T02:14:08.935Z","etag":null,"topics":["date","datetime","days","format","hours","javascript","minutes","node","nodejs","time","time-stamp","timestamp","year"],"latest_commit_sha":null,"homepage":"https://github.com/jonschlinkert","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jonschlinkert.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-05-01T09:01:49.000Z","updated_at":"2024-05-29T11:46:58.000Z","dependencies_parsed_at":"2022-09-05T22:00:54.901Z","dependency_job_id":null,"html_url":"https://github.com/jonschlinkert/time-stamp","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonschlinkert%2Ftime-stamp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonschlinkert%2Ftime-stamp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonschlinkert%2Ftime-stamp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonschlinkert%2Ftime-stamp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jonschlinkert","download_url":"https://codeload.github.com/jonschlinkert/time-stamp/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248654095,"owners_count":21140236,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["date","datetime","days","format","hours","javascript","minutes","node","nodejs","time","time-stamp","timestamp","year"],"created_at":"2024-08-01T19:01:03.430Z","updated_at":"2025-04-13T04:09:20.535Z","avatar_url":"https://github.com/jonschlinkert.png","language":"JavaScript","funding_links":[],"categories":["Modules","模块","Dates and Time"],"sub_categories":["Date \u0026 Time","日期和时间","Reactive Programming"],"readme":"# time-stamp [![NPM version](https://img.shields.io/npm/v/time-stamp.svg?style=flat)](https://www.npmjs.com/package/time-stamp) [![NPM monthly downloads](https://img.shields.io/npm/dm/time-stamp.svg?style=flat)](https://npmjs.org/package/time-stamp) [![NPM total downloads](https://img.shields.io/npm/dt/time-stamp.svg?style=flat)](https://npmjs.org/package/time-stamp) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/time-stamp.svg?style=flat\u0026label=Travis)](https://travis-ci.org/jonschlinkert/time-stamp)\n\n\u003e Get a formatted timestamp.\n\nPlease consider following this project's author, [Jon Schlinkert](https://github.com/jonschlinkert), and consider starring the project to show your :heart: and support.\n\n- [Install](#install)\n- [Usage](#usage)\n- [Customizing the timestamp](#customizing-the-timestamp)\n- [Release history](#release-history)\n  * [v2.0.0](#v200)\n- [About](#about)\n\n_(TOC generated by [verb](https://github.com/verbose/verb) using [markdown-toc](https://github.com/jonschlinkert/markdown-toc))_\n\n## Install\n\nInstall with [npm](https://www.npmjs.com/):\n\n```sh\n$ npm install --save time-stamp\n```\n\n## Usage\n\n```js\nconst timestamp = require('time-stamp');\n\nconsole.log(timestamp());\n//=\u003e 2018-10-26\n\nconsole.log(timestamp.utc());\n//=\u003e 2018-10-26\n```\n\n## Customizing the timestamp\n\nYou may also pass a string to format the generated timestamp.\n\n```js\nconsole.log(timestamp('YYYYMMDD'));\n//=\u003e 20181026\n\nconsole.log(timestamp.utc('YYYYMMDD'));\n//=\u003e 20181026\n```\n\n**Supported patterns**\n\n* `YYYY`: full year (ex: **2018**)\n* `MM`: month (ex: **04**)\n* `DD`: day (ex: **01**)\n* `HH`: hours (ex: **12**)\n* `mm`: minutes (ex: **59**)\n* `ss`: seconds (ex: **09**)\n* `ms`: milliseconds (ex: **532**)\n\n**Usage Examples**\n\n```js\nconsole.log(timestamp('YYYYMMDD'));\n//=\u003e 20181026\nconsole.log(timestamp.utc('YYYYMMDD'));\n//=\u003e 20181026\n\nconsole.log(timestamp('YYYYMMDD:ss'));\n//=\u003e 20181026:24\nconsole.log(timestamp.utc('YYYYMMDD:ss'));\n//=\u003e 20181026:24\n\nconsole.log(timestamp('YYYY/MM/DD:mm:ss'));\n//=\u003e 2018/10/26:46:24\nconsole.log(timestamp.utc('YYYY/MM/DD:mm:ss'));\n//=\u003e 2018/10/26:46:24\n\nconsole.log(timestamp('YYYY:MM:DD'));\n//=\u003e 2018:10:26\nconsole.log(timestamp.utc('YYYY:MM:DD'));\n//=\u003e 2018:10:26\n\nconsole.log(timestamp('[YYYY:MM:DD]'));\n//=\u003e [2018:10:26]\nconsole.log(timestamp.utc('[YYYY:MM:DD]'));\n//=\u003e [2018:10:26]\n\nconsole.log(timestamp('YYYY/MM/DD'));\n//=\u003e 2018/10/26\nconsole.log(timestamp.utc('YYYY/MM/DD'));\n//=\u003e 2018/10/26\n\nconsole.log(timestamp('YYYY:MM'));\n//=\u003e 2018:10\nconsole.log(timestamp.utc('YYYY:MM'));\n//=\u003e 2018:10\n\nconsole.log(timestamp('YYYY'));\n//=\u003e 2018\nconsole.log(timestamp.utc('YYYY'));\n//=\u003e 2018\n\nconsole.log(timestamp('MM'));\n//=\u003e 10\nconsole.log(timestamp.utc('MM'));\n//=\u003e 10\n\nconsole.log(timestamp('DD'));\n//=\u003e 26\nconsole.log(timestamp.utc('DD'));\n//=\u003e 26\n\nconsole.log(timestamp('HH'));\n//=\u003e 00\nconsole.log(timestamp.utc('HH'));\n//=\u003e 04\n\nconsole.log(timestamp('mm'));\n//=\u003e 46\nconsole.log(timestamp.utc('mm'));\n//=\u003e 46\n\nconsole.log(timestamp('ss'));\n//=\u003e 24\nconsole.log(timestamp.utc('ss'));\n//=\u003e 24\n\nconsole.log(timestamp('ms'));\n//=\u003e 186\nconsole.log(timestamp.utc('ms'));\n//=\u003e 186\n```\n\n## Release history\n\n### v2.0.0\n\n**Breaking changes**\n\nDefault pattern was changed from `YYYY:MM:DD` to `YYYY-MM-DD`. See [issues/3](../../issues) for more details.\n\n## About\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003eContributing\u003c/strong\u003e\u003c/summary\u003e\n\nPull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003eRunning Tests\u003c/strong\u003e\u003c/summary\u003e\n\nRunning 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:\n\n```sh\n$ npm install \u0026\u0026 npm test\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003eBuilding docs\u003c/strong\u003e\u003c/summary\u003e\n\n_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_\n\nTo generate the readme, run the following command:\n\n```sh\n$ npm install -g verbose/verb#dev verb-generate-readme \u0026\u0026 verb\n```\n\n\u003c/details\u003e\n\n### Related projects\n\nYou might also be interested in these projects:\n\n* [days](https://www.npmjs.com/package/days): Days of the week. | [homepage](https://github.com/jonschlinkert/days \"Days of the week.\")\n* [iso-week](https://www.npmjs.com/package/iso-week): Get the ISO week of the year. | [homepage](https://github.com/jonschlinkert/iso-week \"Get the ISO week of the year.\")\n* [month](https://www.npmjs.com/package/month): Get the name or number of the current month or any month of the year. | [homepage](https://github.com/datetime/month \"Get the name or number of the current month or any month of the year.\")\n* [months](https://www.npmjs.com/package/months): Months of the year. | [homepage](https://github.com/datetime/months \"Months of the year.\")\n* [o-clock](https://www.npmjs.com/package/o-clock): Simple javascript utility for displaying the time in 12-hour clock format. | [homepage](https://github.com/jonschlinkert/o-clock \"Simple javascript utility for displaying the time in 12-hour clock format.\")\n* [seconds](https://www.npmjs.com/package/seconds): Get the number of seconds for a minute, hour, day and week. | [homepage](https://github.com/jonschlinkert/seconds \"Get the number of seconds for a minute, hour, day and week.\")\n* [week](https://www.npmjs.com/package/week): Get the current week number. | [homepage](https://github.com/datetime/week \"Get the current week number.\")\n* [weekday](https://www.npmjs.com/package/weekday): Get the name and number of the current weekday. Or get the name of the… [more](https://github.com/datetime/weekday) | [homepage](https://github.com/datetime/weekday \"Get the name and number of the current weekday. Or get the name of the weekday for a given number.\")\n* [year](https://www.npmjs.com/package/year): Simple utility to get the current year with 2 or 4 digits. | [homepage](https://github.com/jonschlinkert/year \"Simple utility to get the current year with 2 or 4 digits.\")\n\n### Contributors\n\n| **Commits** | **Contributor** |  \n| --- | --- |  \n| 31 | [jonschlinkert](https://github.com/jonschlinkert) |  \n| 7  | [doowb](https://github.com/doowb) |  \n| 1  | [evocateur](https://github.com/evocateur) |  \n| 1  | [mendenhallmagic](https://github.com/mendenhallmagic) |  \n| 1  | [mvanroon](https://github.com/mvanroon) |  \n| 1  | [leesei](https://github.com/leesei) |  \n| 1  | [sleagon](https://github.com/sleagon) |  \n\n### Author\n\n**Jon Schlinkert**\n\n* [GitHub Profile](https://github.com/jonschlinkert)\n* [Twitter Profile](https://twitter.com/jonschlinkert)\n* [LinkedIn Profile](https://linkedin.com/in/jonschlinkert)\n\n### License\n\nCopyright © 2018, [Jon Schlinkert](https://github.com/jonschlinkert).\nReleased under the [MIT License](LICENSE).\n\n***\n\n_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.8.0, on October 26, 2018._","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjonschlinkert%2Ftime-stamp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjonschlinkert%2Ftime-stamp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjonschlinkert%2Ftime-stamp/lists"}