note 88626 added to function.gmmktime
| From: | (ad) | Date: | Sun, 01 Feb 2009 15:22:38 +0000 |
| Subject: | note 88626 added to function.gmmktime | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-150061@lists.php.net to get a copy of this message | ||
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>
";
----
Server IP: 89.190.194.18
Probable Submitter: 87.121.44.186
----
Manual Page -- http://www.php.net/manual/en/function.gmmktime.php
Edit -- https://master.php.net/note/edit/88626
Del: integrated -- https://master.php.net/note/delete/88626/integrated
Del: useless -- https://master.php.net/note/delete/88626/useless
Del: bad code -- https://master.php.net/note/delete/88626/bad+code
Del: spam -- https://master.php.net/note/delete/88626/spam
Del: non-english -- https://master.php.net/note/delete/88626/non-english
Del: in docs -- https://master.php.net/note/delete/88626/in+docs
Del: other reasons-- https://master.php.net/note/delete/88626
Reject -- https://master.php.net/note/reject/88626
Search -- https://master.php.net/manage/user-notes.php