note 94217 rejected from function.mktime by thiago
| From: | thiago@php.net | Date: | Fri, 23 Oct 2009 03:51:53 +0000 |
| Subject: | note 94217 rejected from function.mktime by thiago | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-161999@lists.php.net to get a copy of this message | ||
Note Submitter: sweet_machine2000 at yahoo dot com
----
I was having problem in adding (h:i) format. i use the following codes but it turns out wrong.
date_default_timezone_set('UTC');
$hours_diff = strtotime("02:00:00")+strtotime("01:00:00");
echo "<br>". date('h:i', $hours_diff);
for adding:
output: 08:31
date_default_timezone_set('UTC');
$hours_diff = strtotime("02:00:00")-strtotime("01:00:00");
echo "<br>". date('h:i', $hours_diff);
for subtracting
output: 01:00
I want the output to have a colon but im having a hard time doing it.