PHPackages                             philippwitzmann/date-time-handler - 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. philippwitzmann/date-time-handler

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

philippwitzmann/date-time-handler
=================================

Date and Time Framework

1.2(6y ago)03271proprietaryPHPCI failing

Since Dec 31Pushed 6y ago1 watchersCompare

[ Source](https://github.com/PhilippWitzmann/DateTimeHandler)[ Packagist](https://packagist.org/packages/philippwitzmann/date-time-handler)[ RSS](/packages/philippwitzmann-date-time-handler/feed)WikiDiscussions master Synced 5d ago

READMEChangelogDependencies (4)Versions (2)Used By (1)

DateTimeHandler
===============

[](#datetimehandler)

This library aims to provide basic functionality to work with (testable) Date, Time and DateTime Objects.

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

[](#installation)

```
composer require philippwitzmann/date-time-handler
```

Usage
-----

[](#usage)

### Create an instance

[](#create-an-instance)

#### With set time

[](#with-set-time)

```
$year  = 2000;
$month = 12;
$day   = 30;

$hours    = 20;
$minutes  = 58;
$seconds  = 13;

$timeZone = new DateTimeZone('Europe/Berlin');

$dateTimeHandler = new DateTimeHandler(
    $year, $month, $day, $hours, $minutes, $seconds, $timeZone
);
```

#### With current time

[](#with-current-time)

```
$dateTimeHandler = new DateTimeHandler();
```

### Diff two DateTimes

[](#diff-two-datetimes)

```
$dateTimeHandler = new DateTimeHandler(
            $year, $month, $day, $hours, $minutes, $seconds, $timeZone
        );

$date                  = new Date($year + 1, $month, $day);
$time                  = new Time($hours, $minutes, $seconds);
$dateTimeToDiffAgainst = new DateTime(
    $date, $time, $timeZone
);

$dateInverval = $dateTimeHandler->diff($dateTimeToDiffAgainst);
```

### Set Test Time

[](#set-test-time)

```
$dateTimeHandler = new DateTimeHandler();
$dateTimeHandler->setTestNow(); //freezes time

$dateTimeHandler->getTime(); // returns the Time, setTestNow() was called at.
```

Running tests
-------------

[](#running-tests)

```
php vendor/bin/phpunit tests/ --configuration=config/phpunit.xml
```

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity57

Maturing project, gaining track record

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

Unknown

Total

1

Last Release

2329d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/36b7e5183f1f5da9648653b84421f6fc9e05845222ceea8b3b541ec7e2b01faa?d=identicon)[PhilippWitzmann](/maintainers/PhilippWitzmann)

### Embed Badge

![Health badge](/badges/philippwitzmann-date-time-handler/health.svg)

```
[![Health](https://phpackages.com/badges/philippwitzmann-date-time-handler/health.svg)](https://phpackages.com/packages/philippwitzmann-date-time-handler)
```

###  Alternatives

[ashallendesign/short-url

A Laravel package for creating shortened URLs for your web apps.

1.4k1.9M4](/packages/ashallendesign-short-url)[solspace/craft-freeform

The most flexible and user-friendly form building plugin!

52664.9k12](/packages/solspace-craft-freeform)[intervention/zodiac

Zodiac Sign Calculator

58191.7k](/packages/intervention-zodiac)[erlandmuchasaj/laravel-gzip

Gzip your responses.

40129.3k2](/packages/erlandmuchasaj-laravel-gzip)[solspace/craft-calendar

The most powerful event management and calendaring plugin!

1830.8k1](/packages/solspace-craft-calendar)

PHPackages © 2026

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