Sorry, ma son stato via tutto il WE.
Ammesso che tu gli passi quante ore vuoi aggiungere/togliere, basta creare una funzioncina che converte le tue (ad esempio) 4.5 ore e le converte in ore, minuti e secondi.
Qualcosa del genere insomma:
Codice PHP:
<?php
function create_str($hours){
$hours=abs($hours);
$h=floor($hours);
$m=floor($hours*60-$h*60);
$s=floor($hours*3600-$h*3600-$m*60);
$str="PT".$h."H".$m."M".$s."S";
return $str;
}
$h=-4.51; /*Ore da aggiungere/togliere*/
$date = new DateTime('2000-01-01 0:0:1',new DateTimeZone('Europe/Berlin'));
echo $date->format('Y-m-d H:i:s') . "
";
if($h>0)
$date->add(new DateInterval(create_str($h)));
else
$date->sub(new DateInterval(create_str($h)));
echo $date->format('Y-m-d H:i:s') . "
";
?>