ID: 39701
User updated by: mgs at au dot ru
Reported By: mgs at au dot ru
Status: Bogus
Bug Type: Date/time related
Operating System: Linux, Win-XP
PHP Version: 5.2.0
New Comment:
I don't think so. gmmktime always treated the parameters (even if they
are absent) as GMT ones.
qoute from manual
Like mktime(), arguments may be left out in order from right to left,
with any omitted arguments being set to the current corresponding GMT
value.
Previous Comments:
------------------------------------------------------------------------
[2006-12-01 19:24:17] [EMAIL PROTECTED]
Without any parameters mktime() and gmmktime() are equivalent
to time(). Which means the returned value will always be the
same no matter the timezone.
To ensure that you get the desired date you need to use gmdate
() function in your code, in which case you'll see the desired
results.
------------------------------------------------------------------------
[2006-12-01 13:34:22] mgs at au dot ru
Description:
------------
In php4 this piece of code (except date_default_timezone_get) works
properly (gmtime was localtime+3(Hours)) but since date/time block was
rewritten (and date_default_timezone_get is born which is happen
~PHP5.1.0) mktime and gmmktime both return the same value and
date_default_timezone_get returns "Europe/Moscow".
What can be wrong?
Reproduce code:
---------------
<?php
$timelocal=mktime();
$timegm=gmmktime();
echo "local=$timelocal\n";
echo "gm =$timegm\n";
echo "local=".date("d-m-Y H:i:s",$timelocal);
echo "\n";
echo "gm =".date("d-m-Y H:i:s",$timegm);
echo "\n";
echo date_default_timezone_get()."\n";
?>
Expected result:
----------------
local=1164979830
gm =1164990643
local=01-12-2006 16:30:30
gm =01-12-2006 19:30:30
Europe/Moscow
Actual result:
--------------
local=1164979830
gm =1164979830
local=01-12-2006 16:30:30
gm =01-12-2006 16:30:30
Europe/Moscow
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=39701&edit=1