{"id":18879754,"url":"https://github.com/loilo/node-php-date","last_synced_at":"2025-04-14T19:23:26.615Z","repository":{"id":12220572,"uuid":"71251004","full_name":"loilo/node-php-date","owner":"loilo","description":"⏰ Use PHP's date() function in JavaScript","archived":false,"fork":false,"pushed_at":"2022-09-29T18:27:39.000Z","size":55,"stargazers_count":2,"open_issues_count":0,"forks_count":3,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-04-14T10:16:05.005Z","etag":null,"topics":["date","date-formatting","javascript"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/loilo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-10-18T13:26:59.000Z","updated_at":"2021-12-05T05:55:19.000Z","dependencies_parsed_at":"2022-08-07T06:16:48.232Z","dependency_job_id":null,"html_url":"https://github.com/loilo/node-php-date","commit_stats":null,"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/loilo%2Fnode-php-date","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/loilo%2Fnode-php-date/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/loilo%2Fnode-php-date/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/loilo%2Fnode-php-date/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/loilo","download_url":"https://codeload.github.com/loilo/node-php-date/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248943508,"owners_count":21186975,"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","date-formatting","javascript"],"created_at":"2024-11-08T06:39:11.522Z","updated_at":"2025-04-14T19:23:26.582Z","avatar_url":"https://github.com/loilo.png","language":"JavaScript","readme":"# php-date\n\n[![Tests](https://badgen.net/github/checks/loilo/node-php-date/master)](https://github.com/loilo/node-php-date/actions)\n[![Version on npm](https://badgen.net/npm/v/php-date)](https://www.npmjs.com/package/php-date)\n\nThis package aims to mimic the formatting of [PHP's date](http://php.net/manual/en/function.date.php) function in JavaScript.\n\n- [Almost all](#timezone-identifiers) tokens are supported\n- Tiny (1.2KB minified \u0026 gzipped)\n- Type annotations included\n- Works in all modern browsers, IE11 and Node.js\n\n## Installation\n\nInstall via npm:\n\n```bash\nnpm install --save php-date\n```\n\nOr use in the browser via [unpkg](https://unpkg.com) (using the global `phpDate` variable):\n\n```html\n\u003cscript src=\"https://unpkg.com/php-date\"\u003e\u003c/script\u003e\n```\n\n## Usage\n\nThe signature looks like this:\n\n```ts\ndate (formatter: string, date: Date = new Date): string\n```\n\nSo just use it mostly like in PHP:\n\n```js\nconst date = require('php-date')\n\nconst releaseDate = new Date(2016, 9, 18)\n\ndate('d.m.Y', releaseDate) // 18.10.2016\ndate('F jS Y', releaseDate) // October 18th 2016\n```\n\nSometimes you want to format a given date for the UTC timezone. You can do so by using the `date.UTC` function, it has the same signature as the `date` function itself:\n\n```js\ndate.UTC(...)\n```\n\nThe second argument is completely optional; like in PHP this will default to the current point in time.\n\n### Timezone Identifiers\n\nThe only PHP date tokens not supported by this package are timezones (tokens `e` and `T`) which would return timezone identifiers. I felt like that would bloat the code a little too much with the fallbacks necessary for older browsers.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Floilo%2Fnode-php-date","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Floilo%2Fnode-php-date","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Floilo%2Fnode-php-date/lists"}