function NextMonthYear($fecha) { if (Month($fecha) == "12") { return intval(Year($fecha)) + 1 . "-01"; } return Year($fecha) . "-" . (intval(Month($fecha)) + 1 < 10 ? "0" : "") . (intval(Month($fecha)) + 1); }
protected function DateValidation($year, $month, $day) { if (Day($year, $month, $day) == true && Month($year, $month, $day) == true && (Year($year, $month, $day) >= 1800 && Year($year, $month, $day) <= 2299)) { return true; } else { return false; } }
function Day($year, $month, $day) { $ArrayDay1 = array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31); $ArrayDay2 = array(31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31); if (Month($year, $month, $day) == true) { $WhichMonth = MonthOfYears($year, $month, $day); if (YearLeast($year, $month, $day) == true) { if ($ArrayDay2[$WhichMonth - 1] == $day) { return true; } else { return false; } } else { if ($ArrayDay1[$WhichMonth - 1] == $day) { return true; } else { return false; } } } }
<?php $fecha = $fec_inicial; do { $fechas = array(); foreach ($fecs as $f) { if (MonthYear($f["fecha"]) == MonthYear($fecha)) { $fechas[intval(Day($f["fecha"]))] = "Servicio"; } } ?> <div class="mesCalendario"> <?php echo $this->calendar->generate(Year($fecha), Month($fecha), $fechas); ?> <p> </p> </div> <?php $fecha = NextMonthYear($fecha) . "-01"; } while (MonthYear($fecha) != NextMonthYear($fec_final));