tm / time-conversion
This package is abandoned and no longer maintained.
No replacement package was suggested.
Convert, compare and operate with time in different units.
Package info
github.com/tommy-muehle/php-time-conversion
Type:project
pkg:composer/tm/time-conversion
1.0.0
2016-12-19 13:43 UTC
Requires
- php: >=5.6.0
Requires (Dev)
- codeclimate/php-test-reporter: ^0.3.2
- tm/tooly-composer-script: ^1.2
This package is auto-updated.
Last update: 2021-06-11 20:37:45 UTC
README
Convert, compare and operate with time in different unit's.
Features
- Conversion between different time unit's
- Support for comparing different time unit's like equals or greaterThan
- Support for math operations like add and subtract
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.