PHPackages                             tm/time-conversion - 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. tm/time-conversion

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

tm/time-conversion
==================

Convert, compare and operate with time in different units.

1.0.0(9y ago)264MITPHP &gt;=5.6.0

Since Dec 19Compare

[ Source](https://github.com/tommy-muehle/php-time-conversion)[ Packagist](https://packagist.org/packages/tm/time-conversion)[ Docs](https://github.com/tommy-muehle/php-time-conversion)[ RSS](/packages/tm-time-conversion/feed)WikiDiscussions Synced 2w ago

READMEChangelog (1)Dependencies (2)Versions (2)Used By (0)

php-time-conversion
===================

[](#php-time-conversion)

[![Minimum PHP Version](https://camo.githubusercontent.com/86e7d829a466cacd5658a22073e27d49d39dac72cc18216ac4963ed5463c5bbc/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253345253344253230352e362d3838393242462e7376673f7374796c653d666c61742d737175617265)](https://php.net/)[![Build Status](https://camo.githubusercontent.com/2c0192460b2e5ce4a409de8b43e1d2713aa7709c8f6c1e42eec374710837af4b/68747470733a2f2f7472617669732d63692e6f72672f746f6d6d792d6d7565686c652f7068702d74696d652d636f6e76657273696f6e2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/tommy-muehle/php-time-conversion)[![Test Coverage](https://camo.githubusercontent.com/96164c44ffc208b7a733cdc63b9463566f1079df1db2ca80e3541b6afc57d034/68747470733a2f2f636f6465636c696d6174652e636f6d2f6769746875622f746f6d6d792d6d7565686c652f7068702d74696d652d636f6e76657273696f6e2f6261646765732f636f7665726167652e737667)](https://codeclimate.com/github/tommy-muehle/php-time-conversion/coverage)[![GitHub license](https://camo.githubusercontent.com/7013272bd27ece47364536a221edb554cd69683b68a46fc0ee96881174c4214c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e737667)](https://raw.githubusercontent.com/tommy-muehle/php-time-conversion/master/LICENSE)[![GitHub issues](https://camo.githubusercontent.com/544fd75a6af811edae983836ff562f9398b7d9aeefa977a65b81c63f4ecf5e9c/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732f746f6d6d792d6d7565686c652f7068702d74696d652d636f6e76657273696f6e2e737667)](https://github.com/php-time-conversion/issues)

Convert, compare and operate with time in different unit's.

Features
--------

[](#features)

- [Conversion between different time unit's](examples/basic-usage.php)
- [Support for comparing different time unit's like equals or greaterThan](examples/compare-usage.php)
- [Support for math operations like add and subtract](examples/math-usage.php)

Example
-------

[](#example)

```
use TM\TimeConversion\Time;
use TM\TimeConversion\Unit;

// convert
$tenWeeks = Time::fromValue(10.0, Unit::WEEK);
$tenWeeksInDays = $tenWeeks->convert(Unit::DAY);

echo $tenWeeksInDays->getAmount(); // 70

// compare
var_dump($tenWeeks->equals($tenWeeksInDays)); // true

// subtract
echo $tenWeekInDays->subtract(Time::fromValue(10, Unit::DAY)); // 60

```

For more and advanced examples look into the [examples directory](examples).

Requirements
------------

[](#requirements)

- PHP &gt;= 5.6
- Composer

Install
-------

[](#install)

```
composer require tm/time-conversion ^1.0

```

Contributing
------------

[](#contributing)

Please refer to [CONTRIBUTING.md](CONTRIBUTING.md) for information on how to contribute.

###  Health Score

26

—

LowBetter than 40% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community2

Small or concentrated contributor base

Maturity58

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

3527d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/618c748bc15b0e91e6280fcf687e28c1afaeb36335d634372d85f7eba3f0cf4f?d=identicon)[tommymuehle](/maintainers/tommymuehle)

---

Tags

unitconversiontimetransformtime-unit

### Embed Badge

![Health badge](/badges/tm-time-conversion/health.svg)

```
[![Health](https://phpackages.com/badges/tm-time-conversion/health.svg)](https://phpackages.com/packages/tm-time-conversion)
```

###  Alternatives

[symfony/clock

Decouples applications from the system clock

432219.5M498](/packages/symfony-clock)[cuyz/valinor

Dependency free PHP library that helps to map any input into a strongly-typed structure.

1.5k14.6M201](/packages/cuyz-valinor)[florianv/swap

PHP currency conversion library for retrieving exchange rates from 30+ providers, with caching and fallback.

1.3k6.9M25](/packages/florianv-swap)[knplabs/knp-time-bundle

Making your dates and durations look sensible and descriptive

6329.7M60](/packages/knplabs-knp-time-bundle)[spatie/color

A little library to handle color conversions

38222.1M39](/packages/spatie-color)[league/period

Time range API for PHP

7335.9M27](/packages/league-period)

PHPackages © 2026

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