note 93409 modified in function.mktime by danbrown

From: Date: Tue, 08 Sep 2009 22:28:04 +0000
Subject: note 93409 modified in function.mktime by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-160334@lists.php.net to get a copy of this message
to ADD or SUBSTRACT times NOTE that if you dont specify the UTC zone your result is the difference +- your server UTC delay. if you are ina utc/GMT +1 <?php $hours_diff = strtotime("20:00:00")-strtotime("19:00:00"); echo date('h:i', $hours_diff)." Hours"; ?> it shows: 02:00 Hours but if you use a default UTC time: <?php date_default_timezone_set('UTC'); $hours_diff = strtotime("20:00:00")-strtotime("19:00:00"); echo "<br>". date('h:i', $hours_diff); ?> it shows: 01:00 Hours. --was-- to ADD or SUBSTRACT times NOTE that if you dont specify the UTC zone your result is the difference +- your server UTC delay. if you are ina utc/GMT +1 $hours_diff = strtotime("20:00:00")-strtotime("19:00:00"); echo date('h:i', $hours_diff)." Hours"; it shows: 02:00 Hours but if you use a default UTC time: date_default_timezone_set('UTC'); $hours_diff = strtotime("20:00:00")-strtotime("19:00:00"); echo "<br>". date('h:i', $hours_diff); it shows: 01:00 Hours. http://php.net/manual/en/function.mktime.php

« previous php.notes (#160334) next »