PHPackages                             avadim/chrono - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. avadim/chrono

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

avadim/chrono
=============

Extends the features of PHP DateTime classes

v2.0.1(5y ago)0100MITPHPPHP &gt;=7.3

Since Nov 5Pushed 5y ago1 watchersCompare

[ Source](https://github.com/aVadim483/chrono)[ Packagist](https://packagist.org/packages/avadim/chrono)[ Docs](https://github.com/aVadim483/Chrono)[ RSS](/packages/avadim-chrono/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (7)Dependencies (1)Versions (9)Used By (0)

Chrono [![GitHub tag (latest by date)](https://camo.githubusercontent.com/c420b9c4f00768fa259d0c772ce3142aa3ad7186641ce602e7e73081e8a9e3eb/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f7461672f61566164696d3438332f4368726f6e6f)](https://camo.githubusercontent.com/c420b9c4f00768fa259d0c772ce3142aa3ad7186641ce602e7e73081e8a9e3eb/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f7461672f61566164696d3438332f4368726f6e6f)[![Build Status](https://camo.githubusercontent.com/627894da6aeec05960abf9c16727505f1c818ad7fddab772aae8bc995e328875/68747470733a2f2f7472617669732d63692e6f72672f61566164696d3438332f4368726f6e6f2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/aVadim483/Chrono)
==================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================

[](#chrono--)

Extends the features of PHP DateTime classes

Create Chrono\\DateTime object
------------------------------

[](#create-chronodatetime-object)

```
use avadim\Chrono\Chrono;

// Create date from any type:
//      string - any datetime format
//      integer - unix timestamp
//      DateTime - instance of standard php class
//      Chrono\Chrono - instance of class
// You also can set time zone
$date = Chrono::createDate('now', '+3');

// Current date and time
$date = Chrono::now();

// Current date and time in Africa/Dakar timezone
$date = Chrono::now('Africa/Dakar');

// Current date and time with timezone offset -5
$date = Chrono::now(-5);

// Current date with zero time
$date = Chrono::today();

// Create date corresponding to the arguments given
$date = Chrono::make(1984, 23, 2, 17);
// $date is '1094-23-02 17:00:00

$date = Chrono::make(1984);
// $date is '1994-01-01 00:00:00'

// Create date from arguments with current time
$date = Chrono::createFromDate(1984);
// if current datetime is '2020-07-17 11:34:48' then $date is '1984-07-17 11:34:48'

// Create current date with time from arguments
$date = Chrono::createFromTime(1, 59, 7, '-5');
```

Create period
-------------

[](#create-period)

```
use avadim\Chrono\Chrono;

echo 'Sequence';
foreach (Chrono::createPeriod('now', '+1 week')->sequenceOfDays() as $oDate) {
    echo $oDate, '';
}
```

Date operations
---------------

[](#date-operations)

```
use avadim\Chrono\Chrono;

// Adds any interval (an amount of days, months, years, hours, minutes and seconds) to given date
$date = Chrono::dateAdd('now', '1 week');

// Subtracts any interval from given date
$date = Chrono::dateSub('1742-11-28', 'P2Y1M');

// The same as Chrono::dateAdd() but returns formatted date. String '@999' is a UNIX timestamp
$dateString = Chrono::dateAddFormat('@946684800', '1 year + 2 months + 13 days', 'D M j, Y G:i:s T');

// The same as Chrono::dateAdd() but returns formatted date
$dateString = Chrono::dateSubFormat('Mar 14, 1987', 'P1Y', 'm/d/Y');
```

Compare dates
-------------

[](#compare-dates)

```
use avadim\Chrono\Chrono;

// Calculates the difference between two dates
$date1 = new \DateTime('1985-01-20');
$date2 = new \DateTime('1997-03-27');
$int = Chrono::dateDiffSeconds($date1, 'now');
$int = Chrono::dateDiffMinutes($date1, $date2);
$int = Chrono::dateDiffHours($date1, $date2);
$int = Chrono::dateDiffDays($date1, 'today');

// Compare two dates
// You can use operators: '', 'gt'
$bool = Chrono::compare($date1, '>=', $date2);

// Determines if the passed date is between two other dates
$bool = Chrono::between('1990-12-31', $date1, $date2);
```

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~179 days

Recently: every ~256 days

Total

8

Last Release

1848d ago

Major Versions

0.9.3 → v1.0.02019-09-12

v1.1.0 → v2.0.02021-03-14

PHP version history (2 changes)v0.9PHP &gt;=5.6

v2.0.0PHP &gt;=7.3

### Community

Maintainers

![](https://www.gravatar.com/avatar/bdb51a3c707497a4cc826ec61af31a3f33f2a372d8245e1d17a51be913d1c916?d=identicon)[avadim](/maintainers/avadim)

---

Top Contributors

[![aVadim483](https://avatars.githubusercontent.com/u/2246758?v=4)](https://github.com/aVadim483 "aVadim483 (14 commits)")

---

Tags

datetimetimedatetimezone

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/avadim-chrono/health.svg)

```
[![Health](https://phpackages.com/badges/avadim-chrono/health.svg)](https://phpackages.com/packages/avadim-chrono)
```

###  Alternatives

[brick/date-time

Date and time library

3623.3M60](/packages/brick-date-time)[league/period

Time range API for PHP

7335.4M21](/packages/league-period)[aeon-php/calendar

PHP type safe, immutable calendar library

2079.7M16](/packages/aeon-php-calendar)[tplaner/when

Date/Calendar recursion library.

5261.0M5](/packages/tplaner-when)[dater/dater

Compact PHP library for working with date/time in different formats &amp; timezones.

14282.3k](/packages/dater-dater)[fresh/datetime

PHP library that provides additional functions for processing dates &amp; times.

17513.8k2](/packages/fresh-datetime)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
