I have the following PHP code on my local apache2 webserver on a Mac Book Pro using PHP 5.3.8 and Default timezone set to Europe/Zurich:
$now = time();
$in5min = $now + 300;
echo "now: " . date('H:m:s', $now);
echo "<br>in 5 min: " . date('H:m:s', $in5min);
echo "<br>now using date only: " . date('H:m:s');
Result looks like this (run at 18:16:12, 26 July 2012):
now: 18:07:01
in 5 min: 18:07:01
now using date only: 18:07:01
Note that I can refresh the page – the seconds change, the hours and minutes remain. So 5 minutes later it’s still 18:07.
What’s wrong with my webserver settings? And why does the time calculation not work?
The correct format string is
ifor minutes, notm.mis for months.