// Obtiene toda la información
if (!$HTTP_POST_VARS) {
$theDate = getdate();
$mon = $theDate["mon"]; // Mes en formato numérico (1-12)
$month = $theDate["month"]; // Mes en formato texto (january, feb...)
$year = $theDate["year"]; // Año con cuatro dígitos
}
if ($action = "findDate") {
$theDate = getdate(mktime(0,0,0,$mon,1,$year));
$month = $theDate["month"];
}
// Obtiene en qué cae el primer día de la semana
$tempDate = getdate(mktime(0,0,0,$mon,1,$year));
$firstwday= $tempDate["wday"];
// Obtiene el último día del mes
$cont = true;
$tday = 27;
while (($tday <= 32) && ($cont)) {
$tdate = getdate(mktime(0,0,0,$mon,$tday,$year));
if ($tdate["mon"] != $mon) {
$lastday = $tday - 1;
$cont = false;
}
$tday++;
}
?>