note 70008 added to ref.datetime

From: Date: Fri, 29 Sep 2006 17:04:36 +0000
Subject: note 70008 added to ref.datetime
Groups: php.notes 
Request: Send a blank email to php-notes+get-117841@lists.php.net to get a copy of this message
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; } ---- Server IP: 66.163.161.117 Probable Submitter: 201.6.114.10 ---- Manual Page -- http://www.php.net/manual/en/ref.datetime.php Edit -- https://master.php.net/note/edit/70008 Del: integrated -- https://master.php.net/note/delete/70008/integrated Del: useless -- https://master.php.net/note/delete/70008/useless Del: bad code -- https://master.php.net/note/delete/70008/bad+code Del: spam -- https://master.php.net/note/delete/70008/spam Del: non-english -- https://master.php.net/note/delete/70008/non-english Del: in docs -- https://master.php.net/note/delete/70008/in+docs Del: other reasons-- https://master.php.net/note/delete/70008 Reject -- https://master.php.net/note/reject/70008 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#117841) next »