Posted By

rabc on 07/21/10


Tagged

iphone NSDate


Versions (?)

Who likes this?

7 people have marked this snippet as a favorite

zingo
umang_nine
bobbym245
rvachere
sb
Tintenklecks
cnathan


Number of days in a month


 / Published in: Objective C
 

  1. // number of day in month
  2. NSCalendar* cal = [NSCalendar currentCalendar];
  3. NSDateComponents* comps = [[[NSDateComponents alloc] init] autorelease];
  4. [comps setMonth:[[monthFormat stringFromDate:[NSDate date]] intValue]];
  5. NSRange range = [cal rangeOfUnit:NSDayCalendarUnit
  6. inUnit:NSMonthCalendarUnit
  7. forDate:[cal dateFromComponents:comps]];

Report this snippet  

You need to login to post a comment.