note 88626 deleted from function.gmmktime by danbrown
| From: | danbrown@php.net | Date: | Sun, 01 Feb 2009 16:54:36 +0000 |
| Subject: | note 88626 deleted from function.gmmktime by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-150065@lists.php.net to get a copy of this message | ||
Note Submitter: admin (ad) djokodonev.com
----
I tried making a date & time class of my own...
It was supposed to calculate the server offset in seconds....
gmmktime was supposed to generate the GMT +0000 timestamp as i thought would later on use it for
being sure of the time a supposed event happened by addig the specific time zone offset to display
the date.
The function normally does that, as shown below untill you set a UTC timezone.. Then it returns the
same thing as the time() function...
I am kind new at this so forgive me if I've missed something.
I do not see this mentioned anywhere in the documentation....
The below function will always give the server offset from the GMT +0000, only when the time zone is
UTC some kind, then you get the same results.
This should be mentioned since the first time i saw the function, i thought it should represent the
time stamp relative to the current time zone e.g will produce a timestamp of the current hour in
seconds but in the GMT+0000 zone..
Please avoid using this function since the results are quite unexpected..
See below:
$gmt = gmmktime(date('H', time()),date('i', time()), date('s',
time()), date('m', time()), date('d', time()), date('Y', time()));
echo date("M d Y H:i:s", $gmt)."<br>";
echo date("M d Y H:i:s", time())."<br>";
$serv_offset = $gmt - time();
echo "GMT: ".$gmt."<br>";
echo "TIME: ".time()."<br>";
echo 1233409810 - 1233409819;
echo "<br>".($serv_offset/3600)."<br><br>
";