List Info

Thread: note 70008 added to ref.datetime




note 70008 added to ref.datetime
user name
2006-09-29 17:04:36
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  -- h
ttps://master.php.net/note/delete/70008/integrated
Del: useless     -- http
s://master.php.net/note/delete/70008/useless
Del: bad code    -- htt
ps://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     -- http
s://master.php.net/note/delete/70008/in+docs
Del: other reasons-- https://mast
er.php.net/note/delete/70008
Reject      -- https://mast
er.php.net/note/reject/70008
Search      -- https://
master.php.net/manage/user-notes.php

-- 
PHP Notes Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub
.php

note 70008 deleted from ref.datetime by bobby
user name
2006-09-29 22:51:06
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;
}

-- 
PHP Notes Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub
.php

[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )