note 72658 rejected from function.time by bjori

From: Date: Mon, 05 Feb 2007 07:58:03 +0000
Subject: note 72658 rejected from function.time by bjori
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-122873@lists.php.net to get a copy of this message
Note Submitter: ixtahdoom at gmail dot com ---- This code drifts by one day after 6 loops: $time = mktime(0, 0, 0, 9, 16, 2006); $now = mktime(0,0,0,2,2,2007); $delta = 7 * 24 * 60 * 60; while ($time < $now) { echo "<p>".date("Y-m-d D H:i:s", $time)."</p>\n"; $time += $delta; } Starts with a Saturday, adds a week of seconds, then drifts backwards to Friday after 6 iterations. Is it because a day is not 24 hours?

« previous php.notes (#122873) next »