{"id":17263637,"url":"https://github.com/battye/date-convert","last_synced_at":"2025-03-26T10:41:28.646Z","repository":{"id":62492164,"uuid":"204293991","full_name":"battye/date-convert","owner":"battye","description":"Convert a date string from one format to another.","archived":false,"fork":false,"pushed_at":"2019-08-25T13:22:08.000Z","size":4,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-31T11:50:22.821Z","etag":null,"topics":["date","datetime","php"],"latest_commit_sha":null,"homepage":null,"language":"PHP","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/battye.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":"2019-08-25T12:53:48.000Z","updated_at":"2019-08-25T13:56:56.000Z","dependencies_parsed_at":"2022-11-02T11:16:46.997Z","dependency_job_id":null,"html_url":"https://github.com/battye/date-convert","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/battye%2Fdate-convert","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/battye%2Fdate-convert/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/battye%2Fdate-convert/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/battye%2Fdate-convert/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/battye","download_url":"https://codeload.github.com/battye/date-convert/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245641295,"owners_count":20648636,"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","php"],"created_at":"2024-10-15T07:57:08.601Z","updated_at":"2025-03-26T10:41:28.621Z","avatar_url":"https://github.com/battye.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Date Convert\r\nA small library which uses the `DateTime` object to convert a date string from one format to another.\r\n\r\n## Installation\r\n\r\nInstall this library with composer, using the command `composer require battye/date-convert \"~1.0\"`. If you notice any bugs, please raise an issue or pull request.\r\n\r\n### Simple Usage\r\n\r\nThe original date string must be supplied in the `date()` function. \r\n\r\nThe `from()` function should be used to indicate the format being used, while `to()` should be filled with the desired output format (in conjunction with `datetext()`).\r\n\r\nAn example usage is shown below:\r\n\r\n    use battye\\date_convert\\convert;\r\n    \r\n    $convert = convert::date('2011-01-20 00:00:00+09')\r\n\t    -\u003efrom('Y-m-d H:i:sT')\r\n        -\u003eto('j F y');\r\n        \r\n    $datetime = $convert-\u003edatetime(); // returns a DateTime object\r\n    $datetext = $convert-\u003edatetext(); // returns 20 January 11\r\n    $timestamp = $convert-\u003etimestamp(); // returns 1295449200\r\n    \r\n### Converting Timezones\r\n\r\nTo output a format in a different timezone, it can be specified in either of the following ways prior to calling `datetime()` or `datetext()`. Timestamps are not impacted by timezone.\r\n\r\n    $convert-\u003etimezone(new \\DateTimeZone('Asia/Macau'));\r\n    $convert-\u003etimezone('Asia/Macau');\r\n    \r\n## Tests\r\n\r\n[![Build Status](https://travis-ci.com/battye/date-convert.svg?branch=master)](https://travis-ci.com/battye/date-convert)\r\n\r\nThe unit tests provide good examples of how to utilise this library and can be found in the `tests/` directory. To execute the unit tests, run:\r\n\r\n    vendor/bin/simple-phpunit tests/\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbattye%2Fdate-convert","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbattye%2Fdate-convert","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbattye%2Fdate-convert/lists"}