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

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

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

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 68% 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

1197d 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.1k394.3M1.5k](/packages/nette-utils)[league/period

Time range API for PHP

7335.4M21](/packages/league-period)[morilog/jalali

This Package helps developers to easily work with Jalali (Shamsi or Iranian) dates in PHP applications, based on Jalali (Shamsi) DateTime class.

9201.2M45](/packages/morilog-jalali)[brick/date-time

Date and time library

3623.3M60](/packages/brick-date-time)[aeon-php/calendar

PHP type safe, immutable calendar library

2079.7M16](/packages/aeon-php-calendar)[tplaner/when

Date/Calendar recursion library.

5261.0M5](/packages/tplaner-when)

PHPackages © 2026

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