Thursday, June 28, 2012

Get number of days in a month

NSDate *today=[NSDate date];


NSCalendar *gregorian = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar];
NSRange days = [gregorian rangeOfUnit:NSDayCalendarUnit inUnit:NSMonthCalendarUnit forDate:date];
int daysInGivenMonth= days.length;






No comments:

Post a Comment