Q:

Php: Work with time() and date()

I need a help!!  I need to output the current time (12:00:00) and the time to 30 minutes earlier (11:30:00). 
I used function date() with parameters date("H:i:s"), but i didn`t know how cut 30 minutes.  

A:

You can use the DateTime object
$dateTime = new DateTime();

echo 'Current time is: ' .  $dateTime->format('H:i:s') . ' <br />';

$dateTime->modify('-30 minutes');

echo 'Modified time is: ' .  $dateTime->format('H:i:s');

