lastDayOfMonth:inYear:
Zur Dokumentation für mich selbst und für Leute, die es vielleicht mal brauchen könnten:
+ (NSInteger)lastDayOfMonth:(NSInteger)month inYear:(NSInteger)year {
switch(month) {
case 2:
if(((year % 4) == 0 && (year % 100) != 0) || ((year % 400) == 0)) return 29;
else return 28;
case 4:
case 6:
case 9:
case 11:
return 30;
default:
return 31;
}
}
Diese Funktion gibt einem den letzten Tag im Monat month eines Jahres year zurück.
No comments, yet