|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2000-07-26 19:05 UTC] rasmus@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2026 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 11 02:00:01 2026 UTC |
Twice a year, mktime(0,0,0,$month,$day,$year) returns 3600 seconds too much/to few seconds, as the code below shows. This error is reproduced on PHP 3.??. ... 0922658400 1999-03-29 -3600 0941410800 1999-11-01 3600 0954108000 2000-03-27 -3600 0972860400 2000-10-30 3600 0985557600 2001-03-26 -3600 1004310000 2001-10-29 3600 1017612000 2002-04-01 -3600 1035759600 2002-10-28 3600 1049061600 2003-03-31 -3600 1067209200 2003-10-27 3600 1080511200 2004-03-29 -3600 1099263600 2004-11-01 3600 ... <html><body><?php $prev = 0; for ($year=1970 ; $year < 2038 ; $year++) { for ($month=1 ; $month <= 12; $month++) { switch ($month) { case 4: case 6: case 9: case 11: $days = 30; break; case 2: $days = (($year % 4 == 0) && ($year % 100 != 0) ? 29 : ($year % 400 == 0) ? 29 : 28); break; default: $days = 31; } for ($day=1 ; $day <= $days; $day++) { $date = mktime(0,0,0,$month,$day,$year); if ( $prev != 0 && $prev + 86400 != $date ) { printf("%010d %d-%02d-%02d %d<br>\n",$date,$year,$month,$day,$date-$prev-86400); } $prev = $date; } } } ?></body>