PHPackages                             weblabormx/easy-time - 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. weblabormx/easy-time

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

weblabormx/easy-time
====================

PHP Library to manage time

v1.0.6(7mo ago)05.1kPHPPHP &gt;=5.3.0CI failing

Since Jun 22Pushed 7mo ago1 watchersCompare

[ Source](https://github.com/weblabormx/EasyTime)[ Packagist](https://packagist.org/packages/weblabormx/easy-time)[ RSS](/packages/weblabormx-easy-time/feed)WikiDiscussions master Synced 1mo ago

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

EasyTime
========

[](#easytime)

PHP Library to manage time

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

[](#installation)

- With composer run `composer require weblabormx/easy-time`

### Basics

[](#basics)

First to use the package you will need to add the namespace:

```
use WeblaborMX\EasyTime\EasyTime;
```

Creation
--------

[](#creation)

To create an object you have the next options.

```
$time = EasyTime::createFromSeconds(20465);
$time = EasyTime::createFromFormat('10:30:00'); // HH:ii:ss
$time = EasyTime::createFromFormat('32:10'); // ii:ss
$time = EasyTime::createFromFormat('2:10:30:00'); // With days
$time = EasyTime::create(0, 10, 30, 00); // Days, Hours, Minutes, Seconds
// Parse = createFromFormat
$time = EasyTime::parse('10:30:00'); // HH:ii:ss
$time = EasyTime::parse('32:10'); // ii:ss
$time = EasyTime::parse('2:10:30:00'); // With days
```

Getting Data
------------

[](#getting-data)

You can get the exact second, minute, hour or day, or if you prefer you can convert all data just for one and get for example, the total minutes only.

```
$time = EasyTime::createFromFormat('2:10:30:00');
$time->second; 		// 0
$time->getSeconds(); 	// 210600 (Total seconds in all that time)
$time->minute; 		// 30
$time->getMinutes(); 	// 3510 (Total minutes in all that time)
$time->hour; 		// 10
$time->getHours(); 	// 58.5 (Total hours in all that time)
$time->day; 		// 2
$time->getDays(); 	// 2.42 (Total days in all that time)
$time->format(); 	// '58:30:00'
$time->format('full'); 	// '2:10:30:00'
$time->format('short'); // '30:00'
```

Sum of two objects
------------------

[](#sum-of-two-objects)

There are two options to do it

```
// First way
$sum = EasyTime::sum('00:30:30', '01:03:05');	// 01:33:35

// Second Way
$time = EasyTime::createFromFormat('00:30:30');
$time2 = EasyTime::createFromFormat('01:03:05');
$time = $time->addTime($time2); 	// 01:33:35
```

Rest of two objects
-------------------

[](#rest-of-two-objects)

There are two options to do it

```
// First way
$sum = EasyTime::rest('02:30:30', '01:03:05');	// 01:27:25

// Second Way
$time = EasyTime::createFromFormat('02:30:30');
$time2 = EasyTime::createFromFormat('01:03:05');
$time = $time->subTime($time2); 	// 01:27:25
```

Additions and Substractions
---------------------------

[](#additions-and-substractions)

If you want to add or substract any time you can do it.

```
$time = EasyTime::createFromFormat('00:30:30');
$time = $time->addSeconds(5);		// 0:00:30:35
$time = $time->addSecond();		// 0:00:30:36
$time = $time->addMinutes(6);		// 0:00:36:36
$time = $time->addMinute();		// 0:00:37:36
$time = $time->addHours(2);		// 0:02:37:36
$time = $time->addHour(); 		// 0:03:37:36
$time = $time->addDays(2);		// 2:03:37:36
$time = $time->addDay();		// 3:03:37:36
$time = $time->subDays(2);		// 1:03:37:36
$time = $time->subDay();		// 0:03:37:36
$time = $time->subHours(2);		// 0:01:37:36
$time = $time->subHour();		// 0:00:37:36
$time = $time->subMinutes(6);		// 0:00:31:36
$time = $time->subMinute();		// 0:00:30:36
$time = $time->subSeconds(5);		// 0:00:30:31
$time = $time->subSecond();		// 0:00:30:30
```

Multiply and Divide
-------------------

[](#multiply-and-divide)

```
$time = EasyTime::createFromFormat('00:30:31');
$time = $time->multiply(2); 		// 01:01:02
$time = $time->divide(2); 		// 00:30:31

$time = EasyTime::createFromFormat('00:30:31');
$time = $time->multiply(10.5); 		// 05:20:26
$time = $time->divide(2); 		// 02:40:13
```

Human Readable
--------------

[](#human-readable)

Get the human readable of a time

```
$time = EasyTime::createFromFormat('2:10:30:00');
$time->diffForHumans(); // 2 days, 10 hours, 30 minutes

$time = EasyTime::createFromFormat('00:30:02');
$time->diffForHumans(); // 30 minutes

$time = EasyTime::createFromFormat('02:10:32');
$time->diffForHumans(); // 2 hours, 10 minutes

$time = EasyTime::createFromFormat('01:01:32');
$time->diffForHumans(); // 1 hour, 1 minute
```

### Location

[](#location)

If you want the text in any other language you can specify it. Now its available only English (en) and Spanish (es).

```
$time = EasyTime::createFromFormat('2:10:30:00');
$time->diffForHumans('en'); // 2 days, 10 hours, 30 minutes
$time->diffForHumans('es'); // 2 días, 10 horas, 30 minutos
```

If you want to have it available in your language please email me to  with translations with the next format.

```
'es' => [
    'days' => 'días',
    'day' => 'día',
    'minutes' => 'minutos',
    'minute' => 'minuto',
    'hours' => 'horas',
    'hour' => 'hora',
]
```

###  Health Score

42

—

FairBetter than 90% of packages

Maintenance64

Regular maintenance activity

Popularity20

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity63

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

Recently: every ~759 days

Total

7

Last Release

216d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/13341096?v=4)[Weblabor](/maintainers/weblabormx)[@weblabormx](https://github.com/weblabormx)

---

Top Contributors

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

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/weblabormx-easy-time/health.svg)

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

PHPackages © 2026

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