php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #15029 mktime bug
Submitted: 2002-01-14 09:50 UTC Modified: 2002-01-14 09:56 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: bruno at aries dot lu Assigned:
Status: Not a bug Package: *General Issues
PHP Version: 4.0.6 OS: Windows NT
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: bruno at aries dot lu
New email:
PHP Version: OS:

 

 [2002-01-14 09:50 UTC] bruno at aries dot lu
The underlying code produces a bug in the time calculation of "mktime". The 28th October 2001 has got 25 hours!!!

<?
  function string2date($dat)
  {
    $resu = substr($dat,6,4).substr($dat,3,2).substr($dat,0,2);
    
    return $resu;
  };
  
$date =  "25.10.2001";
$stDate4 = "30.10.2001";
$day = substr($date,0,2);
$month = substr($date,3,2);
$year = substr($date,6,4);

$current_date = mktime (0,0,0,$month,$day,$year);

while ($date != $stDate4)
  {
    // add 1 day = 86400 seconds to the timestamp
    $current_date = $current_date + 86400;
    $date = date ("d.m.Y",$current_date);
    $Date = string2date($date);

/*  // this overrides the bug  
    if ($first_date == $Date)
    {
      $current_date = $current_date + 86400;
      $date = date ("d.m.Y",$current_date);
      $Date = string2date($date);
    }
*/
   echo "$Date<br>";
  }

?>

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-01-14 09:56 UTC] derick@php.net
Yeah, cause that is the date on which summertime becomes wintertime (daylight savings time). Not a bug > bogus
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Fri Jul 04 06:01:38 2025 UTC