note 48004 deleted from function.date by tularis
| From: | tularis@php.net | Date: | Sun, 30 Jan 2005 14:39:56 +0000 |
| Subject: | note 48004 deleted from function.date by tularis | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-84223@lists.php.net to get a copy of this message | ||
Note Submitter: Martín González
----
<?
/*
ENGLISH [Inglés] (excuses for my english, it's not good):
This function allows you to know if the date of a year is real.
It determines leap years (February == 29). If the introduced values are correct will return TRUE,
else return FALSE
Good Luck (Y)
marting_dc(a)yahoo.com
ESPAÑOL [Spanish]:
Esta función te permite determinar si una fecha es correcta.
Determina años bisiestos (Febrero == 29), y los meses que terminan en 31 o los que no.
Si los valores introducidos son correctos el algoritmo devolverá TRUE, sino devolverá FALSE
Suerte (Y)
marting_dc(a)yahoo.com
*/
function determine($day,$month,$year) {
if ($month == 2 && $day > 28) {
$year = $year/4;
$year = number_format($year,2,'.','');
list($ent,$dec) = explode('.',$year);
if ($dec > 0 || $day > 29) {
$cmp = true;
}
} else {
if ($day == 31) {
if ($month == 4 || $month == 6 || $month == 9 ||$month == 11) {
$cmp = true;
}
}
}
if ($cmp == false) {
return true;
} else {
return false;
}
}
if (determine($day,$month,$year)) {
echo 'Fecha buena || The date is ok';
} else {
echo 'Fecha mala || Date wrong';
}
?>