Days between two dates (datediff)


/ Published in: Objective C
Save to your folder(s)



Copy this code and paste it in your HTML
  1. NSCalendar *gregorianCalendar = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar];
  2. NSUInteger unitFlags = NSHourCalendarUnit | NSMinuteCalendarUnit | NSDayCalendarUnit;
  3. NSDateComponents *components = [gregorianCalendar components:unitFlags
  4. fromDate:todaysDate
  5. toDate:lastDate
  6. options:0];
  7. [gregorianCalendar release];
  8.  
  9. NSString *days = [components day];

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.