PHP code example of pavel-krush / duration
1. Go to this page and download the library: Download pavel-krush/duration library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
pavel-krush / duration example snippets
$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