user6631314 user6631314 -4 years ago 178
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

Answer Source

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

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download