xahmedtaha / duration
A php helper function to express time durations and convert them easily.
v1.0.1
2024-09-14 22:55 UTC
Requires
- php: ^8.0
README
A php helper function to express time durations and convert them easily.
Installation
You can install the package via composer:
composer require xahmedtaha/duration
Usage
echo duration(hours: 2, minutes: 24)->inMilliseconds(); // 8640000 echo duration(days: 12, minutes: 24, seconds: 13, milliseconds: 15)->inSeconds(); // 18733.015 echo duration(days: 3, hours: 16)->inMinutes(); // 19680 echo duration(days: 3, hours: 2, minutes: 24)->inHours(); // 74.4 echo duration(days: 12, hours: 3, minutes: 24, seconds: 13, milliseconds: 15)->inDays(); // 12.141817
Credits
License
The MIT License (MIT). Please see License File for more information.