3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $minutes = 8 * 60; $enter1 = (new \DateTime())->setTime(9,37,00); $out1 = (new \DateTime())->setTime(12,56,00); $enter2 = (new \DateTime())->setTime(14,32,00); $partial = (((int)$out1->format('H')) * 60 + (int)$out1->format('i')) - (((int)$enter1->format('H')) * 60 + (int)$enter1->format('i')); $remainingMinutes = $minutes - $partial; $exitAt = clone $enter2; $exitAt->add(new \DateInterval('PT'.$remainingMinutes.'M')); echo "Esci alle: ".$exitAt->format('H:i:m');
based on USE2f
Output for 5.6.0 - 7.3.0alpha1
Esci alle: 19:13:11