note 79612 added to ref.datetime
| From: | jcvpalma at gmail dot com | Date: | Wed, 05 Dec 2007 16:14:14 +0000 |
| Subject: | note 79612 added to ref.datetime | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-132849@lists.php.net to get a copy of this message | ||
Hi,
I am a brazilian programmer and I create this function for compare if the first date is less than
the last date.
this function return true if the date is less.
//Compara se a data 1 é menor que a data 2
function date_compare($dt1, $dt2){
$dataI = explode("/",$dt1);
$dataF = explode("/",$dt2);
$retorno = "";
$dia1 = $dataI[0];
$mes1 = $dataI[1];
$ano1 = $dataI[2];
$dia2 = $dataF[0];
$mes2 = $dataF[1];
$ano2 = $dataF[2];
if ( $ano1 <= $ano2 ) {
if ( $mes1 < $mes2 )
{
if ( $dia1 < $dia2 )
{
$retorno = true;
} elseif($dia1 == $dia2) {
$retorno = true;
}
} elseif ($mes1 == $mes2 )
{
if ( $dia1 < $dia2 )
{
$retorno = true;
} elseif($dia1 == $dia2)
{
$retorno = true;
}
}
}
return $retorno;
}
----
Server IP: 69.147.83.197
Probable Submitter: 200.207.158.76
----
Manual Page -- http://www.php.net/manual/en/ref.datetime.php
Edit -- https://master.php.net/note/edit/79612
Del: integrated -- https://master.php.net/note/delete/79612/integrated
Del: useless -- https://master.php.net/note/delete/79612/useless
Del: bad code -- https://master.php.net/note/delete/79612/bad+code
Del: spam -- https://master.php.net/note/delete/79612/spam
Del: non-english -- https://master.php.net/note/delete/79612/non-english
Del: in docs -- https://master.php.net/note/delete/79612/in+docs
Del: other reasons-- https://master.php.net/note/delete/79612
Reject -- https://master.php.net/note/reject/79612
Search -- https://master.php.net/manage/user-notes.php