NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
Packagist
Packagist, #716 most downloaded on Packagist
A simple API extension for DateTime.
Latest stable
3.5.1
Last release 2 months ago
06 Sep 2026
Release timing varies
gaps range from 1 weeks to 11 months
Most releases are documented
notes for 52 of the last 60 stable releases
Nothing withdrawn
no release was ever pulled
11 years old
77 releases · first in 2015
Drag across the ruler to compare, or tap a release to open it.
Parse fractional seconds in ChronosTime as fractions of a second by @dualfroz in #531
ChronosTime as fractions of a second by @dualfroz in https://github.com/cakephp/chronos/pull/531Full Changelog: https://github.com/cakephp/chronos/compare/3.5.0...3.5.1
Added DST-safe elapsed time arithmetic methods that use Unix timestamp manipulation instead of wall clock time:
Added DST-safe elapsed time arithmetic methods that use Unix timestamp manipulation instead of wall clock time:
addElapsedHours() / subElapsedHours()addElapsedMinutes() / subElapsedMinutes()addElapsedSeconds() / subElapsedSeconds()These methods ensure correct behavior across DST transitions and are true inverses of diffInHours(), diffInMinutes(), and diffInSeconds().
Full Changelog: 3.4.0...3.5.0
Your coding agent can read these notes before it upgrades. Set up the MCP server →
Add withTestNow() for scoped time mocking by @dereuromark in #498
Full Changelog: 3.3.3...3.4.0
Full Changelog: https://github.com/cakephp/chronos/compare/3.3.3...3.4.0
Fix regression in 3.3.2: createFromFormat() with Unix timestamp format ('U') incorrectly applying testNow, reverted due to BC break - #503
Full Changelog: 3.3.2...3.3.3
Fix createFromFormat to respect setTestNow for missing components by @dereuromark in #494
Full Changelog: 3.3.1...3.3.2
Full Changelog: https://github.com/cakephp/chronos/compare/3.3.1...3.3.2
Use match() instead of switch/case. by @ADmad in #487
Full Changelog: https://github.com/cakephp/chronos/compare/3.3.0...3.3.1
Split out toQuarterRange() for cleaner return API. by @dereuromark in #479
Full Changelog: 3.2.0...3.3.0
Full Changelog: https://github.com/cakephp/chronos/compare/3.2.0...3.3.0
Add ChronosPeriod which returns Chronos instances from DatePeriod by @othercorey in #472
Full Changelog: 3.1.0...3.2.0
Full Changelog: https://github.com/cakephp/chronos/compare/3.1.0...3.2.0
Chronos::createFromTimestamp()handles timezones differently. If $timezone is not explicitly passed then the instance has timezone set to +00:00 unlike
Chronos::createFromTimestamp()handles timezones differently. If $timezone is not explicitly passed then the instance has timezone set to +00:00 unlike earlier where the currently set default timezone was used. This behavior change normalizes behavior with changes in PHP 8.4 which adds a new DateTimeInterface::createFromTimestamp() method.Full Changelog: https://github.com/cakephp/chronos/compare/3.0.4...3.1.0
Add ChronosTime::endOfDay() by @othercorey in https://github.com/cakephp/chronos/pull/439
Full Changelog: https://github.com/cakephp/chronos/compare/3.0.3...3.0.4
Restore Chronos::toNative() by @markstory in https://github.com/cakephp/chronos/pull/433
Full Changelog: https://github.com/cakephp/chronos/compare/3.0.2...3.0.3
The Chronos class once again extends DateTimeImmutable and therefore implements DateTimeInterface. ChronosDate and ChronosTime do not. Several paramet
The Chronos class once again extends DateTimeImmutable and therefore implements DateTimeInterface. ChronosDate and ChronosTime do not. Several parameters were expanded to allow DateTimeInterface instead of requiring only Chronos objects.
After making the original changes in 3.0.0, we realized that the supported PHP versions (8.1+) do not have the original bugs that made extending DateTimeImmutable either problematic or impossible in the future.
ChronosDate is intended to be a separate object and will not extend DateTimeImmutable as it supports mutating time and time zones which is hard to support.
ChronosTime was never meant to extend DateTimeImmutable and is part of the reason why ChronosInterface was removed as it doesn't represent a true shared interface.
An explanation of the reason behind the 3.0 changes can be found here: https://github.com/cakephp/chronos/issues/410#issuecomment-1722185717
toDateTimeImmutable() by @othercorey in https://github.com/cakephp/chronos/pull/424 and https://github.com/cakephp/chronos/pull/427Full Changelog: https://github.com/cakephp/chronos/compare/3.0.1...3.0.2
Re-introduce Chronos::getLastErrors() by @othercorey in https://github.com/cakephp/chronos/pull/409
Full Changelog: https://github.com/cakephp/chronos/compare/3.0.0...3.0.1
Chronos 3 introduces some large changes driven by changes in PHP 8 (and expected change in PHP 9).
Chronos 3 introduces some large changes driven by changes in PHP 8 (and expected change in PHP 9).
The biggest change is Chronos and ChronosDate no longer extend DateTimeImmutable which means they no longer implement DateTimeInterface. This will affect projects that use either of these as type declarations and pass in Chronos objects.
All of the relevant methods from DateTimeImmutable are still available on Chronos and ChronosDate. Some methods that were only relevant for Chronos were dropped from ChronosDate and so on.
If you need to pass a DateTimeImmutable or DateTimeInterface objects to a library, you can use the toNative() helper to get the equivalent DateTimeImmutable object.
Chronos and ChronosDate no longer extend DateTimeImmutable and no longer implement DateTimeInterfaceChronosInterface was dropped as Chronos and ChronosDate no longer extend the same base and don't try to share incompatible methods.MutableDateTime and MutableData were droppedChronosTime was added which supports parsing strings and conversion from Chronos and DateTimeInterfaceDefault ChronosTime to server time by @othercorey in https://github.com/cakephp/chronos/pull/386
Full Changelog: https://github.com/cakephp/chronos/compare/3.0.0-beta2...3.0.0-beta3
Remove carbon migration notes by @othercorey in https://github.com/cakephp/chronos/pull/369
Full Changelog: https://github.com/cakephp/chronos/compare/3.0.0-beta1...3.0.0-beta2
Chronos 3.0 will be a major release that contains breaking changes. This beta release provides a preview release of what will be coming in the future…
Chronos 3.0 will be a major release that contains breaking changes. This beta release provides a preview release of what will be coming in the future and unblocks CakePHP 5.0 beta releases.
ChronosDate no longer implements DateTimeInterface and doesn't share types with Chronos either. This resolves a long standing interface compatibility issue where Date and DateTime objects appeared to be more type compatible than they should be.Chronos no longer implements DateTimeInterface or extends DateTimeImmutable. Instead Chronos is a wrapper around PHP's datetime, and continues to offer a similar interface to the PHP objects.In the future 2.4 will be released with deprecations to help with upgrading to chronos 3.x
Fix createFromTimestamp() deprecation message by @othercorey in #485
Full Changelog: 2.5.1...2.5.2
Full Changelog: https://github.com/cakephp/chronos/compare/2.5.1...2.5.2
This release requires PHP 8.4 to match the signature of DateTimeImmutable::createFromTimestamp(). Users not running PHP 8.4+ do not need this version.
This release requires PHP 8.4 to match the signature of DateTimeImmutable::createFromTimestamp(). Users not running PHP 8.4+ do not need this version.
Full Changelog: 2.4.5...2.5.1
Added replacement suggestions for some deprecated functions by @Staubiii in #458
Full Changelog: 2.4.4...2.4.5
Full Changelog: https://github.com/cakephp/chronos/compare/2.4.4...2.4.5
Fix off by one errors in diffFiltered by @markstory in https://github.com/cakephp/chronos/pull/446
Full Changelog: https://github.com/cakephp/chronos/compare/2.4.3...2.4.4
Add microseconds to Chronos::endOfDay() by @othercorey in https://github.com/cakephp/chronos/pull/440
Full Changelog: https://github.com/cakephp/chronos/compare/2.4.2...2.4.3
Fix "undefined array key" error. by @ADmad in https://github.com/cakephp/chronos/pull/415
Full Changelog: https://github.com/cakephp/chronos/compare/2.4.1...2.4.2
Add missing default for ChronosInterface::now() by @othercorey in https://github.com/cakephp/chronos/pull/412
Full Changelog: https://github.com/cakephp/chronos/compare/2.4.0...2.4.1
MutableDate and MutableDateTime were deprecated and will be removed in 3.0
Date was renamed to ChronosDate and will be dropped in 3.0MutableDate and MutableDateTime were deprecated and will be removed in 3.0Full Changelog: https://github.com/cakephp/chronos/compare/2.3.3...2.4.0
Chronos 2.4.0 will be backwards compatible with the rest of Chronos 2.x. However, 2.4.0 will introduce deprecations to the mutable classes and many me…
Chronos 2.4.0 will be backwards compatible with the rest of Chronos 2.x. However, 2.4.0 will introduce deprecations to the mutable classes and many methods in preparation for the changes coming in Chronos 3. The upgrade guide has more information on the upcoming changes and how to update your application.
Chronos 2.4.0 will be backwards compatible with the rest of Chronos 2.x. However, 2.4.0 will introduce deprecations to the mutable classes and many me…
Chronos 2.4.0 will be backwards compatible with the rest of Chronos 2.x. However, 2.4.0 will introduce deprecations to the mutable classes and many methods in preparation for the changes coming in Chronos 3. The upgrade guide has more information on the upcoming changes and how to update your application.
Update docs for Date + timezone by @markstory in https://github.com/cakephp/chronos/pull/388
Full Changelog: https://github.com/cakephp/chronos/compare/2.3.2...2.3.3
Fix: Unexpected Human Interval Values by @MGatner in https://github.com/cakephp/chronos/pull/323
Full Changelog: https://github.com/cakephp/chronos/compare/2.3.1...2.3.2
Fix passing negative value to sub helpers such as subYears(-1) for PHP 8.2
Added missing microsecond() setter.
microsecond() setter.Suppress internal method tentative return type deprecations with ReturnTypeWillChange attribute. https://wiki.php.net/rfc/internal_method_return_types
ReturnTypeWillChange attribute. https://wiki.php.net/rfc/internal_method_return_typesFixed missing integer timestamp support in Chronos + MutableDateTime constructors
Chronos + MutableDateTime constructorsdiffInMonthIgnoreTimezone()Cleaned up diffInMonthsIgnoreTimezone()
Added diffInMonthsIgnoreTimezone() that takes the difference without allowing PHP to convert back to UTC first. For example: 2019-06-01 Asia/Tokyo and
diffInMonthsIgnoreTimezone() that takes the difference without allowing PHP to convert back to UTC first. For example: 2019-06-01 Asia/Tokyo and 2019-10-01 Asia/Tokyo would return 4 instead of 3 that DateTime::diff() would return.Changed Date::createFromFormat() to workaround PHP 8 bug.
Values in the Ymd format can now be parsed.
Ymd format can now be parsed.Moved test cases to match other CakePHP projects
diffInMonths(), diffInYears() and diffInDays().Fix 'alias already defined' errors caused by preloading in PHP7.4
dayOfWeekName magic property.Updated dev dependencies to stable versions.
new instances of Chronos, MutableDateTime, Date, MutableDate from other instances.Features from 1.3.0 were merged in as they were accidentally omitted from the 2.0.0 release.
Date and MutableDate now use server default time zone instead of UTC. This makes using Date objects easier for time zones that are far away from UTC a
Date and MutableDate now use server default time zone instead of UTC. This makes using Date objects easier for time zones that are far away from UTC as Date::today() will not be wrong as often.addYears() no longer overflows months. For example adding (new Chronos('2012-02-29'))->addYears(1);Results in 2013-02-28 not 2013-03-01.Chronos\DifferenceFormatterInterface.Chronos::copy() returns a new instance now.Date and MutableDate constructor now allow time zones to be passed in. This allows you to take dates from other time zones. The default time zone is used if not specified.ChronosInterval now supports microseconds.addYearsWithOverflow() to retain backwards compatibility with the previous behavior of addYears().createFromArray() to ease creating instances from array data.…greaterThan and equals(). In the future we may deprecate and remove the short forms in order to increase readability of the API.
createFromArray() was added to make creating instances from array based data.gt() and eq() are now aliases for the long form methods greaterThan and equals(). In the future we may deprecate and remove the short forms in order to increase readability of the API.Additional fixes for relative time parsing with test now instances.
Fixed regression in parse() with relative times that was introduced in 1.2.6
Documentation now included in this repository.
testNow() is now used when parsing relative datetimes that only supply the time component.Fix maxValue and minValue not working when timezone is not UTC.
Improved compatibility of __debugInfo methods with IDE debugging.
__debugInfo methods with IDE debugging.Carbon aliases are no longer set if Carbon is also installed.
Fix typing issues that cause errors under strict_types in php 7.1+
Fix testNow being mutated by relative time strings.
Tests are no longer run against HHVM
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Added isNext\* and isLast\* methods
Nothing published for this version
Nothing published for this version
Nothing published for this version
One column per quarter.