Use DateTime.add(DateInterval)
DateInterval {
/* Properties */
public integer $y ;
public integer $m ;
public integer $d ;
public integer $h ;
public integer $i ;
public integer $s ;
public integer $invert ;
public mixed $days ;
/* Methods */
public __construct ( string $interval_spec )
public static DateInterval createFromDateString ( string $time )
public string format ( string $format )
}
So, you need to add 3 DateInterval
's; 7 hours 59 minutes 59 seconds.. then add another second - and lastly 14 hours. Or whatever your logic is, make some math from the hour / minute / second of the DateTime
and adjust your DateInterval
accordingly. Each time you add an interval, you print a formatted datetime string.