We can use the below script to subtract half an hour from the given time in PHP.

<?php

date_default_timezone_set(‘UTC’);

$actualTime = strtotime(‘2010-07-28 15:00:00′);

$modifiedTime = $actualTime – strtotime(’00:30:00’);

echo “Modified time: ” . date(“H:i a”, $modifiedTime);

?>

Above script gives the output as

Modified time: 14:30 pm

Advertisements