joanfabregat/iso8601-to-seconds
最新稳定版本:v1.0
Composer 安装命令:
composer require joanfabregat/iso8601-to-seconds
包简介
Converts ISO 8601 duration to seconds
README 文档
README
A simple package to convert ISO 8601 duration to seconds
Installation
The package is available on Packagist. The recommended way to install the library is through Composer:
composer require joanfabregat/iso8601-to-seconds
Usage
use JoanFabregat\Iso8601ToSeconds\Iso8601ToSeconds; $seconds = Iso8601ToSeconds::convert('PT1H'); echo $token; // will echo 3600 $interval = new DateInterval('PT1H'); $seconds = Iso8601ToSeconds::convert($interval); echo $token; // will echo 3600 $interval = DateInterval::createFromDateString('1 hour'); $seconds = Iso8601ToSeconds::convert($interval); echo $token; // will echo 3600 // will throw an \InvalidArgumentException exception $token = Iso8601ToSeconds::convert('a random string');
License
The library is published under the MIT license (see LICENSE file).
统计信息
- 总下载量: 64
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-04-30