PHP code example of symandy / duration
1. Go to this page and download the library: Download symandy/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/ */
symandy / duration example snippets
use Symandy\Component\Duration\Duration;
$duration = new Duration('4 minutes 40 seconds');
$duration = new Duration('4m 40s');
use Symandy\Component\Duration\Duration;
$duration = new Duration('4 minutes 40 seconds');
echo $duration->format(); // Default : 0:04:40
echo $duration->format('%h:%m:%s'); // 0:04:40
echo $duration->format('%mm%ss'); // 4m 40s
use Symandy\Component\Duration\Duration;
$duration = new Duration('4 minutes 40 seconds');
$duration->addMinutes(10);
echo $duration->format('%mm%ss'); // 14m 40s