PHPackages                             craigsefton/chronos - 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. craigsefton/chronos

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

craigsefton/chronos
===================

Extensions to the standard PHP DateTime class.

v1.0.1(10y ago)117[1 PRs](https://github.com/craigsefton/chronos/pulls)MITPHPPHP &gt;=5.2.0

Since Mar 7Pushed 5y ago1 watchersCompare

[ Source](https://github.com/craigsefton/chronos)[ Packagist](https://packagist.org/packages/craigsefton/chronos)[ RSS](/packages/craigsefton-chronos/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependencies (1)Versions (4)Used By (0)

Chronos Date &amp; Time Library
===============================

[](#chronos-date--time-library)

Installation
------------

[](#installation)

### Via Composer

[](#via-composer)

1. Run the command: `composer require "craigsefton/chronos:*"`

### Manual Installation

[](#manual-installation)

1. Clone this repository: `git clone git@github.com:craigsefton/chronos.git`
2. Change to the cloned folder, e.g.: `cd chronos`
3. Run command `composer install`

Testing Your Installation
-------------------------

[](#testing-your-installation)

All tests are built using PHPUnit, which should have been installed as part of the composer installation (PHPUnit is a dev dependency).

To run all tests, run the command `vendor/bin/phpunit` from within the Chronos folder.

Example Usage
-------------

[](#example-usage)

This extends the default PHP DateTime class, and provides some additional functionality. All methods manipulate the current object, unless stipulated otherwise. In addition, all methods return the current object, so methods can be chained, if desired.

```
use \Chronos\ChronosDateTime;
$date = new ChronosDateTime("2015-03-15 23:00:00");
echo $date->endOfYear()->startOfDay();
// Prints Thu, 31 Dec 2015 00:00:00 +0000
```

As you can see, you can also print objects. A default format for printing can be set using `$date->setDefaultFormat()`.

Timezones
---------

[](#timezones)

One import thing to note is that the default TimeZone for Chronos is UTC. Otherwise, usage of TimeZones works the same as the normal DateTime library.

Start of week
-------------

[](#start-of-week)

In addition, the library treats the starting day of a week to be Monday, and the end of the week to be Sunday.

```
use \Chronos\ChronosDateTime;
$date = new ChronosDateTime("2015-03-15 23:00:00");
echo $date->startOfFirstDayOfWeek();
// Prints Mon, 09 Mar 2015 00:00:00 +0000
```

Date Validation
---------------

[](#date-validation)

The class also implements an excellent date validator, taken from

```
use \Chronos\ChronosDateTime;
// False
echo ChronosDateTime::validateDate('2012-02-30 12:12:12');
echo ChronosDateTime::validateDate('14:77', 'H:i');
// True
echo ChronosDateTime::validateDate('Tue, 28 Feb 2012 12:12:12 +0200', 'D, d M Y H:i:s O');
```

###  Health Score

26

—

LowBetter than 41% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity60

Established project with proven stability

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 ~885 days

Total

3

Last Release

1996d ago

Major Versions

v1.0.1 → 2.0.0.x-dev2021-01-11

PHP version history (2 changes)v1.0.0PHP &gt;=5.2.0

2.0.0.x-devPHP ~7.2

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1564213?v=4)[Craig Sefton](/maintainers/craigsefton)[@craigsefton](https://github.com/craigsefton)

---

Tags

phpdatetimetimedatechronos

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/craigsefton-chronos/health.svg)

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

###  Alternatives

[aeon-php/calendar

PHP type safe, immutable calendar library

20410.2M16](/packages/aeon-php-calendar)[kartik-v/php-date-formatter

A Javascript datetime formatting and manipulation library using PHP date-time formats.

461.6M3](/packages/kartik-v-php-date-formatter)[dater/dater

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

14283.6k](/packages/dater-dater)[zjkal/time-helper

一个简单快捷的PHP日期时间助手类库。 a smart PHP datetime helper library.

21030.2k2](/packages/zjkal-time-helper)[danielstjules/php-pretty-datetime

Generates human-readable strings for PHP DateTime objects

5797.0k](/packages/danielstjules-php-pretty-datetime)[advmaker/carbon-period

Extension of nesbot/carbon plugin, to work with date period

10116.0k](/packages/advmaker-carbon-period)

PHPackages © 2026

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