Bug #18538 Updated: Probleme with mktime()
| From: | hholzgra@php.net | Date: | Wed, 24 Jul 2002 14:14:50 +0000 |
| Subject: | Bug #18538 Updated: Probleme with mktime() | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-15048@lists.php.net to get a copy of this message | ||
ID: 18538
Updated by: hholzgra@php.net
Reported By: cyril.joui@123bootik.com
-Status: Open
+Status: Bogus
Bug Type: Date/time related
Operating System: Win2000
PHP Version: 4.2.1
New Comment:
daylight saving time ...
Previous Comments:
------------------------------------------------------------------------
[2002-07-24 09:44:45] cyril.joui@123bootik.com
We have probleme when $date >= 2002-10-20 <= 2002-10-31
You can try to do this :
------------EXAMPLE --------------
<?php
$date_depart = "2003-10-26";
// We add 7 days to $date_depart
$date_apres = calcul_date_ajoute_jour($date_depart,7);
// $date_apres is false ... ????
?>
------------END OF EXAMPLE --------------
// Add days to date
function calcul_date_ajoute_jour($date,$nbjour){ // Date au Format
Américain
return date_plus($nbjour,1,$date);
}
function date_time($i) {
$i = strtotime($i);
//echo "$i = $i<br>";
return mktime(
date("H", $i),
date("i", $i),
date("s", $i),
date("m", $i),
date("d", $i),
date("Y", $i));
}
function date_plus($e = 2, $o = 2,$d=1) {
if ($d==1) $d=date("Y-m-d");
$aujourdui = date_time($d);
$apres = getdate(($aujourdui + (86400 * $e)));
$mois=substr("0".$apres[mon],-2,2);
$jour=substr("0".$apres[mday],-2,2);
if($o == 2) return $mois . "-" . $jour;
else return $apres[year] . "-" . $mois . "-" . $jour;
}
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=18538&edit=1