note 86084 added to function.mktime
| From: | Anonymous at osu1 dot php dot net | Date: | Thu, 02 Oct 2008 12:28:14 +0000 |
| Subject: | note 86084 added to function.mktime | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-144973@lists.php.net to get a copy of this message | ||
Don't know about others, but this makes more sense to me:
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.
----
Server IP: 195.184.96.15
Probable Submitter: 85.82.198.72
----
Manual Page -- http://www.php.net/manual/en/function.mktime.php
Edit -- https://master.php.net/note/edit/86084
Del: integrated -- https://master.php.net/note/delete/86084/integrated
Del: useless -- https://master.php.net/note/delete/86084/useless
Del: bad code -- https://master.php.net/note/delete/86084/bad+code
Del: spam -- https://master.php.net/note/delete/86084/spam
Del: non-english -- https://master.php.net/note/delete/86084/non-english
Del: in docs -- https://master.php.net/note/delete/86084/in+docs
Del: other reasons-- https://master.php.net/note/delete/86084
Reject -- https://master.php.net/note/reject/86084
Search -- https://master.php.net/manage/user-notes.php