user6631314 user6631314 - 3 months ago 33
iOS Question

IOS: NSDate dateWithTimeIntervalSinceNow

how would I use NSDate's dateTimeIntervalSinceNow method to calculate the difference between today and an NSDate sometime in the future?

The examples I have seen all take arguments such as the number of seconds:

NSDate *date = [NSDate dateWithTimeIntervalSinceNow:60*60*24*3];

I would like to perform the operation on another NSDate as in:


NSDate *date = NSDate dateWithTimeIntervalSinceNow:(NSDate*)futureDate];

Can anyone suggest best way to do this?

Thank you


As suggested by Dan in his comment, [futureDate timeIntervalSinceNow] accomplishes the task.