php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #52956 date manquante ou en double
Submitted: 2010-09-29 23:28 UTC Modified: 2010-09-29 23:42 UTC
From: o dot brizard at gmail dot com Assigned:
Status: Not a bug Package: Date/time related
PHP Version: Irrelevant OS: OSX (MAMP)
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: o dot brizard at gmail dot com
New email:
PHP Version: OS:

 

 [2010-09-29 23:28 UTC] 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


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-09-29 23:41 UTC] cataphract@php.net
-Status: Open +Status: Bogus
 [2010-09-29 23:41 UTC] cataphract@php.net
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.
 [2010-09-29 23:42 UTC] cataphract@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.

Sorry the message was wrong. This is NOT a bug.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Jun 14 23:01:29 2024 UTC