|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2002-07-24 10:14 UTC] hholzgra@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2026 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 07 11:00:02 2026 UTC |
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; }