![]() |
![]() |
|
|
|||||||
| Registrieren | Hilfe/Forumregeln | Benutzerliste | Kalender | Suchen | Heutige Beiträge | Alle Foren als gelesen markieren |
| Programmierung Rat & Tat für Programmierer |
|
|
Themen-Optionen | Ansicht |
|
|
#2 |
|
Inventar
![]() Registriert seit: 13.06.2001
Beiträge: 1.830
|
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
}
Code:
$startday = date('w',strtotime($year.($month < 10 ? '0' : '').$month.'01'));
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) |
|
|
|
| Aktive Benutzer in diesem Thema: 1 (Registrierte Benutzer: 0, Gäste: 1) | |
| Themen-Optionen | |
| Ansicht | |
|
|