Tuesday, July 27, 2010

iPhone : Time interval with a given date

NSDate *now = [NSDate date];
//refDate is the date you select from picker
NSDate *refDate = [datePicker date];

NSTimeInterval difference = [now timeIntervalSinceDate:refDate];
NSString *strTimeDiff =[[NSString alloc] initWithFormat:@"%0.0f",difference];

No comments:

Post a Comment