From:             ransico at iinet dot net dot au
Operating system: windows, unix
PHP version:      Irrelevant
PHP Bug Type:     Date/time related
Bug description:  gmdate and date odd behaivour

Description:
------------
Hi,

I have been tearing my hair out about this - until I discovered the
underlying problem when I wrote the test code below.

The problem occurs in version 4, aswell as the latest v5 CVS. I have tried
on redhat linux and windows XP. 

When the server is in a non GMT timezone, you would expect gmdate and date
to produce different times - and they normally do so. however, when you
ask the format to be 'U' (timestamp), gmdate appears to produce the
incorrect result - it does NOT take into account that it is supposed to
make a GMT result.

The code I attached shows the contradiction in the results of gmdate and
date, when using a timestamp, and normal formatting.

Note, the anomolies only appear in timestamps.

Is this intentional? if so, it is very odd behaivour.

Reproduce code:
---------------
print "<br>" . gmdate('U');
print "<br>" . date('U');
print "<br>" . gmdate('g:ia \o\n D d<\sup>S</\sup> M, Y');
print "<br>" . date('g:ia \o\n D d<\sup>S</\sup> M, Y');

Expected result:
----------------
1086707744
1086743744
1:15am on Wed 09th Jun, 2004
11:15am on Wed 09th Jun, 2004

Actual result:
--------------
1086743744
1086743744
1:15am on Wed 09th Jun, 2004
11:15am on Wed 09th Jun, 2004

-- 
Edit bug report at http://bugs.php.net/?id=28705&edit=1
-- 
Try a CVS snapshot (php4):  http://bugs.php.net/fix.php?id=28705&r=trysnapshot4
Try a CVS snapshot (php5):  http://bugs.php.net/fix.php?id=28705&r=trysnapshot5
Fixed in CVS:               http://bugs.php.net/fix.php?id=28705&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=28705&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=28705&r=needtrace
Need Reproduce Script:      http://bugs.php.net/fix.php?id=28705&r=needscript
Try newer version:          http://bugs.php.net/fix.php?id=28705&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=28705&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=28705&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=28705&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=28705&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=28705&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=28705&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=28705&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=28705&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=28705&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=28705&r=float

Reply via email to