druc / time-convert
Helps you convert time units and increase readability
v0.1
2018-05-20 14:15 UTC
Requires
- php: >=7.0.0
Requires (Dev)
- phpunit/phpunit: 6.*
This package is auto-updated.
Last update: 2024-11-09 03:26:51 UTC
README
A small package to help you convert time units and increase readability.
return TimeConvert::hours(12)->toMinutes(); // readable and meaningful vs return 60 * 12;
Install
Via Composer
$ composer require druc/time-convert
Usage
TimeConvert::seconds(60)->toMinutes(); // 1 TimeConvert::seconds(3600)->toHours(); // 1 TimeConvert::seconds(86400)->toDays(); // 1 TimeConvert::minutes(1)->toSeconds(); // 60 TimeConvert::minutes(60)->toHours(); // 1 TimeConvert::minutes(1440)->toDays(); // 1 TimeConvert::hours(1)->toSeconds(); // 3600 TimeConvert::hours(1)->toMinutes(); // 60 TimeConvert::hours(24)->toDays(); // 1 TimeConvert::days(1)->toSeconds(); // 86400 TimeConvert::days(1)->toMinutes(); // 1440 TimeConvert::days(1)->toHours(); // 24
License
The MIT License (MIT). Please see License File for more information.