From:             [EMAIL PROTECTED]
Operating system: Windows NT
PHP version:      4.0.6
PHP Bug Type:     *General Issues
Bug description:  mktime bug

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>";
  }

?>
-- 
Edit bug report at: http://bugs.php.net/?id=15029&edit=1


-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to