PHPackages                             chaoswd/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. chaoswd/datetime

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

chaoswd/datetime
================

v1.1.0(7mo ago)10MITPHPPHP ^8.2

Since Oct 20Pushed 7mo agoCompare

[ Source](https://github.com/ChaosWebDev/DateTime)[ Packagist](https://packagist.org/packages/chaoswd/datetime)[ RSS](/packages/chaoswd-datetime/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (3)Used By (0)

Chaos\\DT
=========

[](#chaosdt)

Lightweight PHP DateTime utility library providing a simple, chainable interface for timestamp manipulation and formatting.
Designed as a minimal alternative to `Carbon\Carbon`, it allows quick date/time operations without dependencies.

🕓 Features
----------

[](#-features)

- Simple object wrapper around UNIX timestamps
- Supports numeric, string, and `DateTimeInterface` inputs
- Chainable time adjustment methods (`adjSec`, `adjMin`, `adjHour`, `adjDay`, `adjWeek`)
- Built-in helpers for quick usage (`now()`, `epoch()`)
- Lightweight — no external dependencies

📦 Installation
--------------

[](#-installation)

Install via Composer:

```
composer require chaoswd/datetime
```

Or manually include the files in your project and autoload via PSR-4.

🚀 Usage
-------

[](#-usage)

```
use Chaos\DT\DT;

$now = DT::now();
echo $now->format(); // 2025-10-20 12:00:00

// Adjust the date/time
$nextDay = $now->copy()->adjDay(1)->format('Y-m-d');
echo $nextDay; // 2025-10-21

// Built-in helper functions
echo now()->adjHour(2)->format('H:i:s');
echo epoch(); // 1730000000 || Current Epoch timestamp
```

⚙️ Methods
----------

[](#️-methods)

MethodDescription`__construct($value = null)`Accepts timestamp, string, or DateTimeInterface. Defaults to current time.`format(string $pattern = 'Y-m-d H:i:s')`Returns formatted date/time string.`copy()`Returns a cloned DT instance.`adjSec(int $adj)`Adjusts seconds by ± value.`adjMin(int $adj)`Adjusts minutes by ± value.`adjHour(int $adj)`Adjusts hours by ± value.`adjDay(int $adj)`Adjusts days by ± value.`adjWeek(int $adj)`Adjusts weeks by ± value.🧩 Helpers
---------

[](#-helpers)

Two optional global helper functions are included in `src/helpers.php`:

```
now();   // Returns Chaos\DT\DT::now()
epoch(); // Returns current UNIX timestamp
```

---

🧑‍💻 Author
----------

[](#‍-author)

**Chaos Web Dev**

---

Changelog
---------

[](#changelog)

See [CHANGELOG.md](CHANGELOG.md) for version history.

---

License
-------

[](#license)

This package is open-sourced software licensed under the [MIT license](LICENSE).

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance65

Regular maintenance activity

Popularity2

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

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

Total

2

Last Release

210d ago

### Community

Maintainers

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

---

Top Contributors

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

### Embed Badge

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

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

PHPackages © 2026

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