{"id":18576092,"url":"https://github.com/thiagodp/tdatetime","last_synced_at":"2025-04-10T08:31:02.359Z","repository":{"id":26345544,"uuid":"29794407","full_name":"thiagodp/TDateTime","owner":"thiagodp","description":"⏰ Easy-to-used date and time extensions for PHP's DateTime class","archived":false,"fork":false,"pushed_at":"2022-12-18T17:22:08.000Z","size":30,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-24T19:01:40.489Z","etag":null,"topics":["date","datetime","php","phputil","time"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/thiagodp.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-01-24T22:40:43.000Z","updated_at":"2022-12-18T17:22:46.000Z","dependencies_parsed_at":"2023-01-14T04:27:57.496Z","dependency_job_id":null,"html_url":"https://github.com/thiagodp/TDateTime","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thiagodp%2FTDateTime","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thiagodp%2FTDateTime/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thiagodp%2FTDateTime/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thiagodp%2FTDateTime/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thiagodp","download_url":"https://codeload.github.com/thiagodp/TDateTime/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248185320,"owners_count":21061494,"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","phputil","time"],"created_at":"2024-11-06T23:23:33.390Z","updated_at":"2025-04-10T08:31:02.028Z","avatar_url":"https://github.com/thiagodp.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# TDateTime\n\n[![Build Status](https://travis-ci.org/thiagodp/TDateTime.svg?branch=master)](https://travis-ci.org/thiagodp/TDateTime)\n\nEasy-to-use date and time extensions for PHP's [DateTime](http://php.net/manual/en/class.datetime.php) class.\n\n* No external dependencies.\n* Unit-tested\n* Semantic versioning\n* PHP \u003e= 5.2\n\n## Installation\n\nInstallation via [Composer](https://getcomposer.org/):\n```shell\ncomposer require phputil/tdatetime\n```\n\n## Documentation\n\nAvailable classes:\n- [phputil\\TDateTime](https://github.com/thiagodp/TDateTime/blob/master/lib/TDateTime.php) (extends PHP's `\\DateTime`)\n- [phputil\\TDate](https://github.com/thiagodp/TDateTime/blob/master/lib/TDate.php) (extends `phputil\\TDateTime`)\n- [phputil\\TTime](https://github.com/thiagodp/TDateTime/blob/master/lib/TTime.php) (extends `phputil\\TDateTime`)\n\n📖 [See the Wiki](https://github.com/thiagodp/TDateTime/wiki).\n\n## Examples\n```php\n\u003c?php\nrequire 'vendor/autoload.php';\n\nuse phputil\\TDateTime; // Allow to use TDateTime without the namespace name\n\n// Creating a datetime\n$dt1 = new TDateTime( '2015-01-20 09:10:55' );\necho $dt1; // 2015-01-20 09:10:55\n\n// Creating a datetime with timezone\n$dt1 = new TDateTime( '2015-01-20 09:10:55', new \\DateTimeZone( 'America/Sao_Paulo' ) );\necho $dt1;\n\n// Easy-to-use methods to get/change date and time attributes\n$dt1-\u003eaddOneDay();        // Adds one day\necho $dt1-\u003eday();         // 21\necho $dt1-\u003edateString();  // 2015-01-21\necho $dt1-\u003etimeString();  // 09:10:55\n\n// Clonnable\n$dt2 = clone $dt1;\necho $dt2; // 2015-01-21 09:10:55\n\n// Chainnable setter methods\n$dt2-\u003esubYears( 1 )-\u003eaddMonths( 11 )-\u003esetDay( 31 ); // 2014-12-31\n\n// Allow to change the format for the current instance\n$dt2-\u003esetLocalDateTimeFormat( TDateTime::AMERICAN_DATETIME_FORMAT );\necho $dt2; // 12/31/2014 09:10:55\n\n// Allow to change the format of ALL instances, but respect local format modifications!\nTDateTime::setGlobalDateTimeFormat( TDateTime::BRAZILIAN_DATETIME_FORMAT );\necho $dt1; // 21/01/2015 09:10:55 -\u003e Brazilian datetime format\necho $dt2; // 12/31/2014 09:10:55 -\u003e American datetime format (respect local formatting)\n\n// Easy comparison\necho $dt2-\u003ebefore( $dt1 ); // true\necho $dt1-\u003ebetween( $dt2, new TDateTime() ); // true\necho $dt1-\u003eequalTo( $dt2 ) ? '=' : '!='; // !=\n\n// Validation (version 1.1+)\necho $dt1-\u003eisValidDatabaseDate( '2000/01/31' ); // true\necho $dt1-\u003eisValidAmericanDate( '01/31/2000' ); // true\necho $dt1-\u003eisValidBrazilianDate( '31/01/2000' ); // true\necho $dt1-\u003eisValidDatabaseDateTime( '2000/01/31 23:59:59' ); // true\necho $dt1-\u003eisValidAmericanDateTime( '01/31/2000 23:59:59' ); // true\necho $dt1-\u003eisValidBrazilianDateTime( '31/01/2000 23:59:59' ); // true\necho $dt1-\u003eisValidTime( '23:59:59' ); // true\necho $dt1-\u003eisValidSimpleTime( '23:59' ); // true\n?\u003e\n```\n\n## License\n\n[LGPL](LICENSE) © [Thiago Delgado Pinto](https://github.com/thiagodp)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthiagodp%2Ftdatetime","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthiagodp%2Ftdatetime","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthiagodp%2Ftdatetime/lists"}