Celest provides a alternative date and time API for PHP. It allows you to correctly manage date and time and to do operations on them. It is based on the JSR-310 project for Java 8.
The recommended way to install Celest is through Composer:
composer require celest/celest
PHP >= 5.6 with GMP and intl extension or a current release of HHVM
Celest uses IANA's time zone database. Changes are distributed via the Celest tzdata repo.
Besides the ISO 8061 calendar, the Minguo and Thai Buddhist calendars are supported. Localization of Month, weekday etc., localized parsing/formatting patterns and names of time zones are supported and provided via the intl extension.
You need to install phpunit manually and a version of doctrine/instantiator that's compatible with php5:
composer require --dev phpunit/phpunit:^5.7 rianium/paratest:~0.15.0 doctrine/instantiator:~1.0.5
Then run make test
for the full testsuite or make test-short
for a testsuite that runs in under a minute.
Warning: Paratest currently doesn't display skipped or incomplete tests in all cases.
As PHP's native \DateTime
mixes Instants with local Date/Time there's two different conversions:
\DateTime
object \DateTime
object in the UTC timezone\DateTime
object\DateTime
object\DatetimeZones
on HVVM. See #6783Thanks to Stephen Colebourne and Michael Nascimento Santos the original authors of JSR-310. Also to Flixbus who partially sponsored the work on Celest.