adevade / seconds
时间转换为秒的辅助工具。
4.0.1
2023-05-25 09:59 UTC
Requires
- php: ^8.0
Requires (Dev)
- laravel/pint: ^1.2
- phpunit/phpunit: ^9.0
README
时间转换为秒的辅助工具。
安装
您可以通过composer安装此包
composer require adevade/seconds
支持的PHP版本
用法
use Adevade\Seconds; Seconds::fromMinutes(2); // returns => (int) 120
可用方法
Seconds::fromMinutes($minutes = 5); Seconds::fromHours($hours = 12); Seconds::fromDays($days = 4); Seconds::fromWeeks($weeks = 2); Seconds::fromMonths($months = 6); Seconds::fromYears($years = 2); Seconds::fromMinute(); Seconds::fromHour(); Seconds::fromDay(); Seconds::fromWeek(); Seconds::fromMonth(); Seconds::fromYear();
可用常量
Seconds::MINUTE; Seconds::HOUR; Seconds::DAY; Seconds::WEEK; Seconds::MONTH; Seconds::YEAR;
月份的平均长度为30.42天。
年份的平均长度为365.24天。
致谢
想法来自@LasseRafn的一条推文。谢谢!