note 70008 deleted from ref.datetime by bobby

From: Date: Fri, 29 Sep 2006 22:51:06 +0000
Subject: note 70008 deleted from ref.datetime by bobby
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-117860@lists.php.net to get a copy of this message
Note Submitter: Oliver Thies oliver_thies at hotmail dot com Reason: non-english ---- function dateAdd($Data,$qtd) { $dia = substr($Data,0,2); $mes = substr($Data,3,2); $ano = substr($Data,6,4); //tratando o mes if ($mes < 10) { $mes = str_replace(0,'',$mes);} //Array para pegar o ultimo dia de cada mes. $ultimodia = array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31); $novodia = $dia + $qtd; //echo $novodia; //break; for(;;) { if ($novodia > $ultimodia[$mes -1]) { $novodia = ($novodia - $ultimodia[$mes -1]); $mes = $mes + 1; if ($mes > 12) { $mes = 1; $ano = $ano + 1; } } else { break; } } if (strlen($mes)==1) { $mes = "0" . $mes; } if (strlen($novodia)==1) { $novodia = "0" . $novodia; } return $novodia . "/" . $mes . "/" . $ano; }

« previous php.notes (#117860) next »