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

ActiveLibrary

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 2mo ago

READMEChangelogDependenciesVersions (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

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community1

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

1945d 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

### Embed Badge

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

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

PHPackages © 2026

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