Bug #18538: Probleme with mktime()
| From: | cyril dot joui at 123bootik dot com | Date: | Wed, 24 Jul 2002 13:44:46 +0000 |
| Subject: | Bug #18538: Probleme with mktime() | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-15045@lists.php.net to get a copy of this message | ||
From: cyril.joui@123bootik.com
Operating system: Win2000
PHP version: 4.2.1
PHP Bug Type: Date/time related
Bug description: Probleme with mktime()
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 bug report at http://bugs.php.net/?id=18538&edit=1
--
Fixed in CVS: http://bugs.php.net/fix.php?id=18538&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=18538&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=18538&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=18538&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=18538&r=support
Expected behavior: http://bugs.php.net/fix.php?id=18538&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=18538&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=18538&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=18538&r=globals