Important
This repository is read-only.
Development happens in the Annabel monorepo.
Issues and pull requests should be opened there.
Immutable date-time operations, timezone conversion, strict parsing, ICU formatting, business calendars, and PSR-20 clocks for PHP applications.
- PHP 8.2 or newer
psr/clock1.0ext-intlwith the required ICU locale data for localized and human-readable formatting
composer require codemonster-ru/datetime:^1.0use Codemonster\DateTime\DateTime;
use Codemonster\DateTime\FrozenClock;
$clock = new FrozenClock(new \DateTimeImmutable('2026-07-31 05:30:00 UTC'));
$publishedAt = DateTime::now($clock, 'Asia/Novokuznetsk')
->addDays(2)
->subtractHours(3)
->toTimezone('UTC');
echo $publishedAt->toIso8601String();All value operations are immutable. Calendar units such as days and months preserve local calendar semantics, while hours, minutes, and seconds represent elapsed time.
Standalone package documentation: docs.codemonster.net/datetime
Annabel framework documentation: docs.codemonster.net/annabel