{"id":42296554,"url":"https://github.com/ivanbeldad/php-dates","last_synced_at":"2026-01-27T10:13:18.658Z","repository":{"id":56994720,"uuid":"108058773","full_name":"ivanbeldad/php-dates","owner":"ivanbeldad","description":"Basic Dates library for PHP","archived":false,"fork":false,"pushed_at":"2017-10-26T02:04:16.000Z","size":55,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-12-23T06:44:13.142Z","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/ivanbeldad.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":"2017-10-24T00:58:16.000Z","updated_at":"2018-05-05T23:19:30.000Z","dependencies_parsed_at":"2022-08-21T13:50:38.716Z","dependency_job_id":null,"html_url":"https://github.com/ivanbeldad/php-dates","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/ivanbeldad/php-dates","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivanbeldad%2Fphp-dates","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivanbeldad%2Fphp-dates/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivanbeldad%2Fphp-dates/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivanbeldad%2Fphp-dates/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ivanbeldad","download_url":"https://codeload.github.com/ivanbeldad/php-dates/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivanbeldad%2Fphp-dates/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28811553,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-27T07:41:26.337Z","status":"ssl_error","status_checked_at":"2026-01-27T07:41:08.776Z","response_time":168,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":"2026-01-27T10:13:18.091Z","updated_at":"2026-01-27T10:13:18.648Z","avatar_url":"https://github.com/ivanbeldad.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PHP Dates\n\n[![Packagist](https://img.shields.io/packagist/v/ivandelabeldad/dates.svg)](https://packagist.org/packages/ivandelabeldad/dates)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://github.com/ivandelabeldad/api-rackian/blob/master/LICENSE)\n\nBasic Dates library for PHP\n\n\n## Install\n```\ncomposer require ivandelabeldad/dates\n```\n\n\n## Usage\n\n### Date, Time, and DateTime\n```php\n// Time only have hour, minute and seconds\n$time = Time::now();\n\n// Date have year, month, day, season and day of week\n$date = Date::now();\n\n// DateTime have date attributes and time either\n$dateTime = DateTime::now();\n```\n\n### Create a Date, Time or DateTime\n```php\n// FROM YEAR-MONTH-DAY HOUR-MINUTE-SECOND\n$time       = Time::create(12, 45, 0);\n$date       = Date::create(1999, 12, 31);\n$dateTime   = DateTime::create(1999, 12, 31, 12, 45, 0);\n\n// FROM CURRENT TIME\n$time       = Time::now();\n$date       = Date::now();\n$dateTime   = DateTime::now();\n\n// FROM TIME IN SECONDS (UNIX TIME)\n$time       = Time::fromUnixTime(time());\n$date       = Date::fromUnixTime(time());\n$dateTime   = DateTime::fromUnixTime(time());\n```\n\n### Get a Date range (Only Dates)\n```php\n$startDate = Date::create(2000, 1, 1);\n$endDate = Date::create(2000, 12, 31);\n\n// Contains every day of the year 2000\n$dates = DateUtils::datesBetween($startDate, $endDate);\n```\n\n### DateLists usage\n```php\n$list = new DateArrayList();\n\n// ADD ONE DATE\n$list-\u003eadd(Date::now());\n\n// ADD MULTIPLE DATES\n$list-\u003eaddAll([\n    $date1,\n    $date2,\n    $date3,\n]);\n\n// RETURN 4\n$list-\u003esize();\n\n// REMOVE FIRST DATE AND MOVE OTHERS TO THE BEGINNING\n$list-\u003eremove(0);\n```\n\n### Sorting using lists\n```php\n// DATES SORTED FROM BEFORE TO AFTER\n$list-\u003esort(new DateNaturalComparator());\n\n// DATES SORTED FROM AFTER TO BEFORE\n$list-\u003esort(new DateNaturalComparator(), false);\n```\n\n### Example of filtering usage\n```php\n// Get only weekends in summer and spring\n$filtered = DateFilter::builder($listOfDates)\n\t-\u003efilterBySeasons([Season::SUMMER, Season::SPRING])\n   \t-\u003efilterByDaysOfWeek([DayOfWeek::SATURDAY, DayOfWeek::SUNDAY])\n    -\u003ebuild();\n```\n\n\n## License\n\nThe API Rackian is open-sourced software licensed under\nthe [MIT LICENSE](https://github.com/ivandelabeldad/php-dates/blob/master/LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fivanbeldad%2Fphp-dates","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fivanbeldad%2Fphp-dates","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fivanbeldad%2Fphp-dates/lists"}