PHP code example of danharper / dti

1. Go to this page and download the library: Download danharper/dti 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/ */

    

danharper / dti example snippets


$dti = new danharper\DTI;

list($from, $to) = $dti->parse('2007-03-01T13:00:00Z');

list($from, $to) = $dti->parse('PT2H30M');
// from is set to 2h30m before the current time

$dti->parse('PT2H30M', new DateTime('2001-01-01'));

$dti->parse('2007-03-01T13:00:00Z/2008-05-11T15:30:00Z');

$dti->parse('2007-03-01T13:00:00Z/P1Y2M10DT2H30M');

$dti->parse('PT2H30M/2007-03-01T13:00:00Z');