|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2004-06-09 09:40 UTC] derick@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Oct 28 03:00:02 2025 UTC |
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