Kenne keine solche Funktion, kann man aber leicht selbst schreiben:
Code:
function getDaysPerMonth($year, $month){
$daysPerMonth = Array(0,31,28,31,30,31,30,31,31,30,31,30,31);
$days = 0;
$isLeapYear = false;
if(($month < 1) || ($month > 12)) return false;
if($month == 2) {
//every 4th year is a leap year, years like 100, 200, 300, 1900 are not,
// 400, 800, 2000 are leap years.
if($year % 100 == 0){
$isLeapYear = ((($year/ 100) % 4) == 0);
} else {
$isLeapYear = (($year % 4) == 0)
}
}
if($month == 2 && $isLeapYear){
$days = 29;
} else {
$days = $daysPerMonth($month);
}
$daysInMonth = Array();
for($i = 0; $i < $days; $i++) $daysInMonth[] = $i
return $daysInMonth
}
Wenn dich die Wochentage interessieren (Montag, Dienstag etc.) würde ich mir den ersten Wochentag über:
Code:
$startday = date('w',strtotime($year.($month < 10 ? '0' : '').$month.'01'));
holen und den Rest dann mit switch ($i+$startday % 7){case 0: ....} machen.
Siehe
http://at.php.net/manual/de/function.strtotime.php und
http://at.php.net/manual/de/function.date.php
jak
____________________________________
Join the DNRC |
Godwin\'s Law (thx@stona)
Documentation is like sex: If it\'s good, it\'s very, very good. If it\'s bad, it\'s better than nothing.
\"In theory, theory and practice are the same. In practice, they are not\" (Lawrence Berra)