Edit report at http://bugs.php.net/bug.php?id=52956&edit=1
ID: 52956 Updated by: cataphr...@php.net Reported by: o dot brizard at gmail dot com Summary: date manquante ou en double -Status: Open +Status: Bogus Type: Bug Package: Date/time related Operating System: OSX (MAMP) PHP Version: Irrelevant Block user comment: N New Comment: This bug has been fixed in SVN. Snapshots of the sources are packaged every three hours; this change will be in the next snapshot. You can grab the snapshot at http://snaps.php.net/. Thank you for the report, and for helping us make PHP better. Not a bug. Adding 60*60*24 to advance a day is not correct because of daylight saving time. Previous Comments: ------------------------------------------------------------------------ [2010-09-29 23:28:08] o dot brizard at gmail dot com Description: ------------ <?php function jours($date_deb,$date_fin){ global $jours; $date1= strtotime($date_deb); //Premiere date $date2= strtotime($date_fin); //Deuxieme date $nbjour=($date2-$date1)/60/60/24;//Nombre de jours entre les deux for($i=1;$i<=$nbjour+1;$i++){ $jours[$i]=date('d-m-Y',$date1); // $jours[$date1]=jddayofweek(unixtojd($date1)); // $jours[date('d-m-Y',$date1)]=jddayofweek(unixtojd($date1)); $date1+=60*60*24; //On additionne d'un jour (en seconde) } return $jours; } jours('01-10-2010','31-03-2011'); echo '<pre>'; print_r($jours); echo '</pre>'; ?> Test script: --------------- En voulant écrire une classe pour un projet de calendrier, j'ai réalisé une fonction qui permet de récupérer toutes les dates en deux dates données.Mais en prenant la plage de date allant du 01-09-2010 au 31-08-2010 j'ai une erreur sur les dates renvoyées. En affinant seule la plage qui comprend la plage 01-10-2010 au 31-03-2011 pose problème. Pour la date du 31-10-2010, elle est répété 2 fois Il manque la date du 27 mars 2011 Testé avec php 5.3.2 et 5.2.13 de MAMP pour OSX 10.6.4 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/bug.php?id=52956&edit=1