Guest User

Untitled

a guest
Aug 21st, 2018
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. How to calculate Mid night time intervals? [closed]
  2. NSDateFormatter * dateFormatter = [[NSDateFormatter alloc] init];
  3. [dateFormatter setDateFormat:@"MM.dd.yyyy hh:mm a"];
  4. NSDate * date1 = [dateFormatter dateFromString:@"01.11.2011 06:30 PM"];
  5. NSDate * date2 = [dateFormatter dateFromString:@"01.12.2011 12:00 PM"];
  6. NSTimeInterval interval = [date2 timeIntervalSinceDate:date1];
  7.  
  8. [dateFormatter setDateFormat:@"hh:mm a"];
  9. NSDate * date1 = [dateFormatter dateFromString:@"06:30 PM"];
  10. NSDate * date2 = [dateFormatter dateFromString:@"12:00 PM"];
  11. NSTimeInterval interval = [date2 timeIntervalSinceDate:date1];
  12.  
  13. NSTimeInterval rightInterval = 24*3600 + [date2 timeIntervalSinceDate:date1];
Add Comment
Please, Sign In to add comment