php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #19914 October 27 2002 spans 90000 seconds. 1:00AM - 1:59AM are not unique times.
Submitted: 2002-10-15 03:26 UTC Modified: 2002-10-15 03:28 UTC
From: jsb17 at NOSPAMcornell dot edu Assigned:
Status: Not a bug Package: Date/time related
PHP Version: 4.2.3 OS: Windows 98
Private report: No CVE-ID: None
 [2002-10-15 03:26 UTC] jsb17 at NOSPAMcornell dot edu
To whom it may concern,

I noticed you have another October date bug pending, but it was in spanish, and I don't understand it.

I believe this is a bug:  October 27, 2002 spans 90000 seconds, rather than 86400.  Please let me know if I am incorrect.

I have isolated the bug on a page on my server:

http://68.50.50.189/wp_test_stuff/bug.php

"01:00 am 27 Oct 2002" appears twice in the list.

Here is the code used to produce this page:

<?php

//  timestamps are 90000 seconds apart
$debug_seven = mktime(0,0,0,10,27,2002);
echo "10-27-2002 timestamp: $debug_seven<br>";
$debug_eight = mktime(0,0,0,10,28,2002);
echo "10-28-2002 timestamp: $debug_eight<p>";

//begin on october 27, 2002, and increment every hour
for ($ts=1035702000; $ts <= 1035792000; $ts+=3600){
  echo "<br>" . date("h:i a d M Y", $ts);
}

echo "<P><HR><P>";

phpinfo();
echo "<hr>$HTTP_USER_AGENT\n";

?>

If this is a bug, I hope you are able to spend less time fixing it than I spent isolating it.

I received the error using a loop to cycle through consecutive days by incrementing my timestamp += 86400.

I have changed my code by using this time-expensive kludge, but it works:

//  increment to the next day
$my_timestamp = mktime(0,0,0,
date("m",$my_timestamp),
date("d",$my_timestamp)+1,
date("Y",$my_timestamp));

I hope I have been clear.  Thank you for your time in considering this.  Please remove the NOSPAM from my e-mail address when replying

-Jon

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-10-15 03:28 UTC] derick@php.net
We are happy to tell you that you just discovered Daylight Savings
Time. For more information see:
http://webexhibits.org/daylightsaving/b.html
 [2011-07-22 11:12 UTC] beakerboy99 at yahoo dot com
I had found a similar "bug" with 2007-11-04 after pulling my hair out trying to find whay a URL link wasn't incrementing properly. I found the 90000 seconds thing, and then figured out it's due to daylight savings time and the extra hour from setting the clocks back.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Dec 26 23:01:28 2024 UTC