|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2004-10-08 06:41 UTC] gschlossnagle@php.net
[2004-10-08 08:56 UTC] derick@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Dec 03 10:00:01 2025 UTC |
Description: ------------ I wrote a little program below that shows the problem. This simply adds 1 day to the date and prints the date. At Oct 31st, 2004, it prints 2004-10-31 TWICE. In other words, the date function is returning an incorrect result. Reproduce code: --------------- <?php define("ONEDAY",86400); // seconds in a day $startdate = "20041001"; $timestamp = strtotime($startdate); for($i=0; $i<95; $i++): $timestamp = $timestamp + ONEDAY; $workingdate = date("Y-m-d",$timestamp); echo("NEXT DAY IS $workingdate <br>"); endfor; ?> Expected result: ---------------- All dates from 10-02-2004 until 01-02-2005 printed one after the other in sequence. Actual result: -------------- NEXT DAY IS 2004-10-26 NEXT DAY IS 2004-10-27 NEXT DAY IS 2004-10-28 NEXT DAY IS 2004-10-29 NEXT DAY IS 2004-10-30 NEXT DAY IS 2004-10-31 NEXT DAY IS 2004-10-31 NEXT DAY IS 2004-11-01 NEXT DAY IS 2004-11-02 NEXT DAY IS 2004-11-03 NEXT DAY IS 2004-11-04 NEXT DAY IS 2004-11-05