tm/time-conversion

This package is not installable via Composer 1.x, please make sure you upgrade to Composer 2+. Read more about our Composer 1.x deprecation policy.
This package is abandoned and no longer maintained. No replacement package was suggested.

Convert, compare and operate with time in different units.

1.0.0 2016-12-19 13:43 UTC

This package is auto-updated.

Last update: 2021-06-11 20:37:45 UTC


README

Minimum PHP Version Build Status Test Coverage GitHub license GitHub issues

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

Features

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.

Requirements

  • PHP >= 5.6
  • Composer

Install

composer require tm/time-conversion ^1.0

Contributing

Please refer to CONTRIBUTING.md for information on how to contribute.