How can I remove 5 minutes from current date () in PHP

I would like to show a date minus 5 minutes from the current time; my code looks like this:

(date('Y-m-d H:i-5:s'))

but this is not correct because it dumps it:

2012-08-08 13: 27-5: 49

any ideas how i can do this? thank!

+5
source share
2 answers

PHP function:

strtotime()

Example:

echo date('Y-m-d H:i:s', strtotime('-5 minutes'));
+23
source

Try it. Solve your problem.

$format = "h:i A";
date_default_timezone_set('Asia/Kolkata');
echo date($format, strtotime("-5 minute"));
0
source

All Articles