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)03291proprietaryPHPCI 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 3w 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 47% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

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

2375d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/16005859?v=4)[Philipp Witzmann](/maintainers/PhilippWitzmann)[@PhilippWitzmann](https://github.com/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

[illuminate/support

The Illuminate Support package.

630113.0M41.0k](/packages/illuminate-support)[spatie/holidays

Calculate public holidays

402860.1k2](/packages/spatie-holidays)[craftcms/feed-me

Import content from XML, RSS, CSV or JSON feeds into entries, categories, Craft Commerce products, and more.

293952.6k30](/packages/craftcms-feed-me)[solspace/craft-freeform

The most flexible and user-friendly form building plugin!

54681.3k17](/packages/solspace-craft-freeform)[pimcore/data-importer

Adds a comprehensive import functionality to Pimcore Datahub

46855.5k5](/packages/pimcore-data-importer)[flarum/core

Delightfully simple forum software.

201.4M2.3k](/packages/flarum-core)

PHPackages © 2026

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