pavel-krush/duration
最新稳定版本:v1.0.0
Composer 安装命令:
composer require pavel-krush/duration
包简介
PHP implementation of GoLang time.Duration
README 文档
README
PHP implementation of GoLang's time.Duration
The code is mostly ported from GoLang source code. See time/format.go and time/time.go
Setup
Ensure you have composer installed, then run the following command:
composer require pavel-krush/duration
That will fetch the library inside your vendor folder. Then you can add the following to your .php files in order to use the library:
require_once __DIR__.'/vendor/autoload.php';
Usage
To parse string containing duration use Parser class:
$d = \PavelKrush\Duration\Parser::fromString("13h10m21s"); print $d->Hours() . "\n"; // 13.345 print $d->Minutes() . "\n"; // 790.7 print $d->Seconds() . "\n"; // 47421 print $d->Round(new \PavelKrush\Duration\Duration(\PavelKrush\Duration\Duration::Minute)); // 13h10m0s
统计信息
- 总下载量: 1.22k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-09-29