ID:               39012
 Updated by:       [EMAIL PROTECTED]
 Reported By:      djmaze at planet dot nl
-Status:           Open
+Status:           Bogus
 Bug Type:         Date/time related
 Operating System: Windows
 PHP Version:      5.1.6
 New Comment:

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

Unix timestamps are always in GMT (=UTC) so there is no problem here.


Previous Comments:
------------------------------------------------------------------------

[2006-10-01 19:57:09] djmaze at planet dot nl

Description:
------------
gmdate('U') shows the incorrect unix epoch.

http://php.net/gmdate: 'Format a GMT/UTC date/time'
http://php.net/date: 'U = Seconds since the Unix Epoch (January 1 1970
00:00:00 GMT)'

After calling date_default_timezone_set() everything is messed up, or
is that the whole purpose but someone forgot to document it?


Reproduce code:
---------------
<?php
function get_unixts()
{
        return array(
        'time()'   => time(),
        'date(\'U\')' => date('U'),
        'date(\'Z\')'  => date('Z'),
        'gmtime' => (time()-date('Z')),
        'gmdate(\'U\')' => gmdate('U'),
        'gmdate(\'Z\')' => gmdate('Z'),
        'date_default_timezone' => date_default_timezone_get(),
        );
}
$def = get_unixts();
date_default_timezone_set('UTC');
$set = get_unixts();

echo '<html><body><table
border="1"><tr><td>type</td><td>normal</td><td>after set
UTC</td></tr>';
foreach ($def as $t => $v)
{
        echo "<tr><td>$t</td><td>$v</td><td>{$set[$t]}</td></tr>";
}
echo '</table></body></html>';
?>

Expected result:
----------------
type        normal      after set UTC
time()      1159732108  1159724908
date('U')   1159732108  1159724908
date('Z')   7200        0
gmtime      1159724908  1159724908
gmdate('U') 1159724908  1159724908
gmdate('Z') 0           0


Actual result:
--------------
type        normal      after set UTC
time()      1159732108  1159732108
date('U')   1159732108  1159732108
date('Z')   7200        0
gmtime      1159724908  1159732108
gmdate('U') 1159732108  1159732108
gmdate('Z') 0           0



------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=39012&edit=1

Reply via email to