{"id":16323095,"url":"https://github.com/danielstjules/php-pretty-datetime","last_synced_at":"2025-05-08T23:29:33.905Z","repository":{"id":9303196,"uuid":"11141544","full_name":"danielstjules/php-pretty-datetime","owner":"danielstjules","description":"Generates human-readable strings for PHP DateTime objects","archived":false,"fork":false,"pushed_at":"2024-02-03T09:10:45.000Z","size":17,"stargazers_count":58,"open_issues_count":1,"forks_count":9,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-12T18:46:36.430Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","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/danielstjules.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2013-07-03T03:59:19.000Z","updated_at":"2025-01-23T00:52:13.000Z","dependencies_parsed_at":"2024-06-19T06:29:38.100Z","dependency_job_id":null,"html_url":"https://github.com/danielstjules/php-pretty-datetime","commit_stats":{"total_commits":20,"total_committers":2,"mean_commits":10.0,"dds":"0.050000000000000044","last_synced_commit":"c489c9052a2d2202e13f899fff98c043f6297910"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielstjules%2Fphp-pretty-datetime","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielstjules%2Fphp-pretty-datetime/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielstjules%2Fphp-pretty-datetime/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielstjules%2Fphp-pretty-datetime/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/danielstjules","download_url":"https://codeload.github.com/danielstjules/php-pretty-datetime/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253162950,"owners_count":21864008,"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":[],"created_at":"2024-10-10T22:53:57.140Z","updated_at":"2025-05-08T23:29:33.882Z","avatar_url":"https://github.com/danielstjules.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"php-pretty-datetime\n===================\n\nGenerates human-readable strings for PHP DateTime objects. It handles dates in the past and future. For future dates, it uses the format 'In x unit', ie: 'In 1 minute'. For dates in the past, it uses 'x unit ago', ie: '2 years ago'.\n\nNote: Comparison of dates, for those beyond a day apart, uses the difference between their Unix timestamps.\n\n## Installation\n\nIf you're using Composer to manage dependencies, you can include the following\nin your composer.json file:\n\n```\n\"require\": {\n    \"danielstjules/php-pretty-datetime\": \"~1.0.0\"\n}\n```\n\nOtherwise, you can simply require the file directly:\n\n```php\nrequire_once 'path/to/php-pretty-datetime/src/PrettyDateTime.php';\n```\n\n## Usage\n\n```php\nuse PrettyDateTime\\PrettyDateTime;\n\nPrettyDateTime::parse(new DateTime('now'));         // Moments ago\nPrettyDateTime::parse(new DateTime('+ 59 second')); // Seconds from now\nPrettyDateTime::parse(new DateTime('+ 1 minute'));  // In 1 minute\nPrettyDateTime::parse(new DateTime('- 59 minute')); // 59 minutes ago\n\n// You can supply a secondary argument to provide an alternate reference\n// DateTime. The default is the current DateTime, ie: DateTime('now'). In\n// addition, it takes into account the day of each DateTime. So in the next\n// two examples, even though they're only a second apart, 'Yesterday' and\n// 'Tomorrow' will be displayed\n\n$now = new DateTime('1991-05-18 00:00:00 UTC');\n$dateTime = new DateTime('1991-05-17 23:59:59 UTC');\nPrettyDateTime::parse($dateTime, $now); // Yesterday\n\n$now = new DateTime('1991-05-17 23:59:59 UTC');\n$dateTime = new DateTime('1991-05-18 00:00:00 UTC');\nPrettyDateTime::parse($dateTime, $now) // Tomorrow\n```\n\n## Tests\n\n[![Build Status](https://travis-ci.org/danielstjules/php-pretty-datetime.png)](https://travis-ci.org/danielstjules/php-pretty-datetime)\n\nFrom the project directory, tests can be ran using `phpunit`\n\n## License\n\nReleased under the MIT License - see `LICENSE.txt` for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanielstjules%2Fphp-pretty-datetime","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdanielstjules%2Fphp-pretty-datetime","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanielstjules%2Fphp-pretty-datetime/lists"}