Creating an interval:
<?php
// full notation
$i = new DateInterval( 'P0003-01-15T06:12:30' );
// abbreviated notation
$i = new DateInterval( 'P3DT6H' );
// from a difference
$d1 = new DateTimeImmutable();
$d2 = new DateTimeImmutable( "2019-10-31 23:00 Europe/London" );
$i = $d1->diff( $d2 );
// displaying the difference
echo $i->format( '%a days, %h hours, %i minutes' ), "\n";
echo $i->format( '%m months, %d days, %h hours, %i minutes' ), "\n";
?>
Output
1850 days, 17 hours, 44 minutes
0 months, 23 days, 17 hours, 44 minutes
<?php
// create from string
$i = DateInterval::createFromDateString( "next weekday" );
?>