PHPackages                             pauci/datetime - 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. [Parsing &amp; Serialization](/categories/parsing)
4. /
5. pauci/datetime

ActiveLibrary[Parsing &amp; Serialization](/categories/parsing)

pauci/datetime
==============

Enhanced DateTime, DateTimeImmutable and DateInterval objects

v0.7.0(3y ago)431.7k21MITPHPPHP ^8.0 || ^8.1 || ^8.2CI failing

Since May 16Pushed 3y ago2 watchersCompare

[ Source](https://github.com/pauci/datetime)[ Packagist](https://packagist.org/packages/pauci/datetime)[ Docs](https://github.com/pauci/datetime)[ RSS](/packages/pauci-datetime/feed)WikiDiscussions master Synced today

READMEChangelog (10)Dependencies (7)Versions (28)Used By (1)

pauci/datetime
==============

[](#paucidatetime)

[![Source Code](https://camo.githubusercontent.com/4ed13443ce13e211f2a3f68c8b9abc5af8784260c8dbc72971c1d9d56f7f2d05/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f736f757263652d70617563692f6461746574696d652d626c75652e7376673f7374796c653d666c61742d737175617265)](https://github.com/pauci/datetime)[![PHP](https://camo.githubusercontent.com/a188d23b3c5432bac056aae339bb722f3c69e670c96d0dcb798c45dc10f3d088/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f70617563692f6461746574696d653f7374796c653d666c61742d737175617265)](https://php.net)[![Latest Version](https://camo.githubusercontent.com/7649be89e2b0b037d46a7500c8e742e14d1f4b6ad35f6d703251e10937173329/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f70617563692f6461746574696d652e7376673f7374796c653d666c61742d737175617265266c6162656c3d72656c65617365)](https://packagist.org/packages/pauci/datetime)[![Build Status](https://camo.githubusercontent.com/cd4960187459654e009ff5bcc6a02b6ba58f7ee1ab2498b7ffeff7a01292b9ee/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f70617563692f6461746574696d652f436f6e74696e756f7573253230496e746567726174696f6e3f7374796c653d666c61742d737175617265)](https://github.com/pauci/datetime/actions?query=workflow%3A%22Continuous+Integration%22)[![Coverage Status](https://camo.githubusercontent.com/7a85ed878fb98cd3bbb3883986312d4dcc5b269d8fd3e670603c861b10f2f371/68747470733a2f2f696d672e736869656c64732e696f2f636f6465636f762f632f6769746875622f70617563692f6461746574696d653f7374796c653d666c61742d73717561726526746f6b656e3d4b6d50536c7142757547)](https://codecov.io/gh/pauci/datetime)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](https://github.com/pauci/datetime/blob/master/LICENSE)[![Total Downloads](https://camo.githubusercontent.com/2ccaa8752fda9f34b05e757a993e25a9fe60df9b0a28709debddb5fe7e4d5baf/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f70617563692f6461746574696d652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/pauci/datetime)

Provides enhanced `DateTime` and `DateInterval` objects with clock abstraction

- based on `DateTimeImmutable` object (to discourage the use of mutable version)
- provides `SystemClock` for production and `FrozenClock` for testing
- provides extra static factory methods: `now()` (uses clock), `fromString()`, `fromTimestamp()`, `fromFloatTimestamp()`
- implements `Stringable` and `JsonSerializable` with implicit conversion to string (ISO 8601)

Examples
--------

[](#examples)

```
use Pauci\DateTime\DateTime;

$now = $clock->now();
// or
DateTime::setClock($clock);
$now = DateTime::now();

echo $now;                                            // 2016-05-20T14:30:54.345678+02:00
echo json_encode($now);                               // "2016-05-20T14:30:54.345678+02:00"
echo DateTime::fromTimestamp(1512148033);             // 2017-12-01T18:07:13+01:00
echo DateTime::fromFloatTimestamp(1512148033.000005); // 2017-12-01T18:07:13.000005+01:00

DateTime::setFormat('Y-m-d H:i:s');
echo $now;                                            // 2016-05-20 14:30:54
echo json_encode($now);                               // "2016-05-20 14:30:54"
```

###  Health Score

38

—

LowBetter than 83% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity29

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity76

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

Recently: every ~98 days

Total

18

Last Release

1264d ago

PHP version history (5 changes)0.2.0PHP ^5.6 || ^7.0

v0.3.0PHP ^7.1

v0.3.6PHP ^7.3 | ^8.0

v0.4.0PHP ~8.0.0||~8.1.0

v0.7.0PHP ^8.0 || ^8.1 || ^8.2

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/2421146?v=4)[Pavol Kirschbaum](/maintainers/pauci)[@pauci](https://github.com/pauci)

---

Top Contributors

[![pauci](https://avatars.githubusercontent.com/u/2421146?v=4)](https://github.com/pauci "pauci (100 commits)")

---

Tags

jsondatetimedateintervalimmutableiso8601microsecond

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/pauci-datetime/health.svg)

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

###  Alternatives

[symfony/symfony

The Symfony PHP framework

31.4k87.2M2.2k](/packages/symfony-symfony)[justinrainbow/json-schema

A library to validate a json schema.

3.6k334.7M793](/packages/justinrainbow-json-schema)[mtdowling/jmespath.php

Declaratively specify how to extract elements from a JSON document

2.0k504.8M167](/packages/mtdowling-jmespathphp)[jms/serializer

Library for (de-)serializing data of any complexity; supports XML, and JSON.

2.3k141.9M929](/packages/jms-serializer)[jms/serializer-bundle

Allows you to easily serialize, and deserialize data of any complexity

1.8k92.4M680](/packages/jms-serializer-bundle)[nesbot/carbon

An API extension for DateTime that supports 281 different languages.

185701.7M5.6k](/packages/nesbot-carbon)

PHPackages © 2026

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