Calling the rangeOfUnit method in the NSCalendar object, you specify both a small and large calendar units. In this case, a day unit within a month unit. With that information in hand, check the length of the returned range to determine how many days in the month:
I ran this example on April 4th, 2012, here is the output:
2012-04-04 21:42:33.816 Sandbox[4862:f803] There are 30 days in the current month.
0 Comments