PHPackages                             shrikeh/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. [Utility &amp; Helpers](/categories/utility)
4. /
5. shrikeh/datetime

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

shrikeh/datetime
================

Simple boilerplate library for dateftime periods and ranges

0.1.1(2y ago)016[1 issues](https://github.com/shrikeh/DateTime/issues)[1 PRs](https://github.com/shrikeh/DateTime/pulls)MITPHPPHP &gt;=8.3

Since Feb 22Pushed 6mo ago1 watchersCompare

[ Source](https://github.com/shrikeh/DateTime)[ Packagist](https://packagist.org/packages/shrikeh/datetime)[ RSS](/packages/shrikeh-datetime/feed)WikiDiscussions main Synced 3w ago

READMEChangelog (2)Dependencies (17)Versions (4)Used By (0)

DateTime
========

[](#datetime)

Boilerplate collections representing DateTime periods and ranges.

Overview
--------

[](#overview)

This adds two utility classes for DateTime usage: `Period`, a class to describe a DateTime "window" (such as a calendar meeting), and `Range`, which describes multiple dates and automatically sorts them, earliest to latest.

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

[](#installation)

Installation is via composer:

```
composer require shrikeh/datetime
```

Usage
-----

[](#usage)

Both classes are written to ensure dates are immutable and so use DateTimeImmutable internally.

### Range

[](#range)

Represent a range of dates. Given the following dates:

```
