note 86084 deleted from function.mktime by danbrown
| From: | danbrown@php.net | Date: | Tue, 02 Nov 2010 17:20:06 +0000 |
| Subject: | note 86084 deleted from function.mktime by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-173690@lists.php.net to get a copy of this message | ||
Note Submitter: Anonymous
----
Don't know about others, but this makes more sense to me:
<?php
function dateserial($year,$month,$day,$hour,$minute,$timezone = "UTC") {
$orgTZ = date_default_timezone_get();
date_default_timezone_set($timezone);
$retval = mktime($hour,$minute,0,$month,$day,$year);
date_default_timezone_set($orgTZ);
return $retval;
}
?>
The order makes more sense and the timezone defaults to UTC unless otherwise specified. The fact
that you have to set the timezone gives you more control and forces you to be aware of it.