PHPackages                             theoaks/relative-datetime-format-builder - 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. theoaks/relative-datetime-format-builder

ActiveLibrary

theoaks/relative-datetime-format-builder
========================================

Object Oriented approach to building the different relative date/time formats that the strtotime(), DateTime and date\_create() parser understands.

v1.0.3(3y ago)22.1k↓100%GPL-3.0-or-laterPHPPHP ^8.1

Since Feb 3Pushed 3y agoCompare

[ Source](https://github.com/theoaks/relative-datetime-format-builder)[ Packagist](https://packagist.org/packages/theoaks/relative-datetime-format-builder)[ Docs](https://github.com/theoaks/relative-datetime-format-builder)[ RSS](/packages/theoaks-relative-datetime-format-builder/feed)WikiDiscussions main Synced today

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

Relative DateTime Format Builder
================================

[](#relative-datetime-format-builder)

Object-Oriented approach to building the different relative date/time formats that the strtotime(), DateTime and date\_create() parser understands. [Check The PHP Documentation for details](https://www.php.net/manual/de/datetime.formats.relative.php)

How to install
--------------

[](#how-to-install)

Install using composer

```
composer require theoaks/relative-datetime-format-builder

```

How to use
----------

[](#how-to-use)

```
use Oaks\RelativeDatetimeFormatBuilder\RelativeDateTimeFormatBuilder;

$first_day_of_january = RelativeDateTimeFormatBuilder::firstDayOf(
            MonthName::January
        );
echo $first_day_of_january;
$date = $first_day_of_january->toDateTime();

echo $date->format("y-M-d");

/// first day of January this year
/// YYYY-01-01

$three_days_from_now = (new RelativeDateTimeFormatBuilder())->addDays(3);
echo $three_days_from_now;

$date = $three_days_from_now->toDateTime();
$date_immutable = $three_days_from_now->toDateTimeImmutable();
/// +3 day

// First day of march 2025 at 11am
$format = (new RelativeDateTimeFormatBuilder())
->firstDay()
->ofMarch()
->year(2025)
->at(hour: 11);

echo  $format;
// first day of March 2025 11:00:00
```

###  Health Score

31

—

LowBetter than 71% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity22

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity62

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

Total

4

Last Release

1149d ago

### Community

Maintainers

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

---

Top Contributors

[![theoaksoft](https://avatars.githubusercontent.com/u/39459178?v=4)](https://github.com/theoaksoft "theoaksoft (2 commits)")

---

Tags

datetimestrtotimeFormating

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/theoaks-relative-datetime-format-builder/health.svg)

```
[![Health](https://phpackages.com/badges/theoaks-relative-datetime-format-builder/health.svg)](https://phpackages.com/packages/theoaks-relative-datetime-format-builder)
```

###  Alternatives

[nette/utils

🛠 Nette Utils: lightweight utilities for string &amp; array manipulation, image handling, safe JSON encoding/decoding, validation, slug or strong password generating etc.

2.1k383.2M1.3k](/packages/nette-utils)[cakephp/chronos

A simple API extension for DateTime.

1.4k47.0M101](/packages/cakephp-chronos)[jenssegers/date

A date library to help you work with dates in different languages

1.9k11.0M72](/packages/jenssegers-date)[nesbot/carbon

An API extension for DateTime that supports 281 different languages.

164648.9M4.2k](/packages/nesbot-carbon)[carbonphp/carbon-doctrine-types

Types to use Carbon in Doctrine

209209.5M5](/packages/carbonphp-carbon-doctrine-types)[league/period

Time range API for PHP

7535.3M17](/packages/league-period)

PHPackages © 2026

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