php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #7038 mktime returns incorrect values for some years
Submitted: 2000-10-05 07:15 UTC Modified: 2000-10-05 21:53 UTC
From: jkakar at nisa dot net Assigned:
Status: Closed Package: Date/time related
PHP Version: 4.0.3RC2 OS: RedHat Linux 7.0
Private report: No CVE-ID: None
 [2000-10-05 07:15 UTC] jkakar at nisa dot net
mktime() should return 86400 (the number of seconds in a
day) for the following calculations.  For some years (1972,
1978, 1989, 1995, 2000, etc.) it returns 90000 instead of
86400.  The following code will demonstrate this.

<?php
function
mktime_test ()
{
  for ($i = 0; $i < 100; ++$i)
    {
      /* $timestamp should = 86400.  (ie: 60 x 60 x 24). */
      $timestamp = mktime (0,0,0,10,30,$i) - mktime
(0,0,0,10,29,$i);

      if ($i < 10)
	{
          $year = "200" . $i;
	}
      else if ($i < 70)
	{
          $year = "20" . $i;
	}
      else
        {
          $year = "19" . $i;
	}

      printf ("
$year - $timestamp<br>
");
    }
}

mktime_test ();
?>

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-10-05 21:53 UTC] stas@php.net
Not every day is 86400 seconds. Due to timezone changes, some days can be 1 hour longer or shorter (or, more precisely, distance between certain minutes on the edge of DST can be 1 hour more or less than usual). 
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 07:01:27 2024 UTC