NSDate *date = [NSDate date]; NSTimeInterval timeInterval = YOUR_DOUBLE_VALUE; NSLog(@"Time Interval : %.2f", timeInterval); date = [date dateByAddingTimeInterval:timeInterval]; NSLog(@"Date : %@",date); For Minutes : +/-(no.of mins * 60); For Hours : +/-(no. of hrs * 60 * 60); For days : +/-(no. of days * 60 * 60 * 24); + sign for add. - sign for subtract. Both will work.
NSTimeInterval accepts double value.
No comments:
Post a Comment