|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #13288 date() works incorrectly for first week of April 2001
Submitted: 2001-09-13 13:13 UTC Modified: 2001-09-13 15:19 UTC
From: SeanECoates at yahoo dot ca Assigned:
Status: Closed Package: Date/time related
PHP Version: 4.0.6 OS: Win2000
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: SeanECoates at yahoo dot ca
New email:
PHP Version: OS:


 [2001-09-13 13:13 UTC] SeanECoates at yahoo dot ca
I hope I haven't overlooked something (again), but this just popped up, and is hurting my current application, big-time.

PHP is reporting certain timestamps as the wrong date (specifically, I've found the first week of April 2001 the be erraneous). I noticed that MySQL was converting a specific set of timestamps to dates differently than my php app. So, I tested against perl as well, and PHP is definitely doing SOMETHING weird.. 

Here are the results:

SELECT 986184000 AS unix_time,
       FROM_UNIXTIME(986184000) AS date_stamp,
       UNIX_TIMESTAMP('2001-04-01 23:00:00') AS unix_time
--> unix_time=98618400, date_stamp='2001-04-01 23:00:00', unix_time=98618400

sean@linux1:~$ echo '<?php $date_stamp=986184000; echo $date_stamp ." = ". date("M d, Y, H:i:s A",$date_stamp) ."\n" ?>' | php -q
986184000 = Apr 01, 2001, 23:00:00 PM

sean@linux1:~$ perl -MPOSIX -le 'print ctime(986184000)'
Sun Apr  1 23:00:00 2001

Again, I'm really sorry to waste your collective time if this is my mistake.



Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2001-09-13 13:32 UTC] SeanECoates at yahoo dot ca
I'm dumb...
Let me get back on this.. might be a windows issue.



 [2001-09-13 13:35 UTC] SeanECoates at yahoo dot ca
Seems to be a windows issue:

Here's my test script:
<?php $date_stamp=986184000; echo $date_stamp ." = ". date("M d, Y, H:i:s A",$date_stamp) ?>

986184000 = Apr 02, 2001, 00:00:00 AM
-Linux (Linux linux1 2.2.19 #1 Tue Jul 3 09:26:00 EST 2001 i686 unknown)
986184000 = Apr 01, 2001, 23:00:00 PM

Is this a Daylight Savings Time issue? Why only on windows? .. sorry for the confusion. (and the really stupid initial bug report examples (-: )


 [2001-09-13 13:37 UTC]
locale / country settings ?
 [2001-09-13 15:13 UTC]
There is a bug in the windows time routines, that shows up when daylight
starts on April 1.  It affects the first week of April.

*sigh* Do I need to say more about windows?
 [2001-09-13 15:19 UTC] SeanECoates at yahoo dot ca
Great. I mean, not great, but thanks for the help.

It looks like Visual Studio has been fixed to avoid this. Any idea when we can expect fresh Win32 PHP binaries? I have no compiling facilities on Win32 )-:

Thanks again!

PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Tue May 30 11:03:42 2023 UTC