JiteshW
JiteshW

Reputation: 2205

NSDate - Setting a future date

Facing some problem in setting up future date. Actually I m trying to do this,

NSDate *date = [NSDate date] + MY_EXTRA_TIME;

Upvotes: 5

Views: 3614

Answers (2)

SwiftArchitect
SwiftArchitect

Reputation: 48514

Swift

let delay:NSTimeInterval = 5
let fireDate = NSDate().dateByAddingTimeInterval(delay)

Upvotes: 1

EmptyStack
EmptyStack

Reputation: 51374

That should be,

NSTimeInterval MY_EXTRA_TIME = 10; // 10 Seconds
NSDate *futureDate = [[NSDate date] dateByAddingTimeInterval:MY_EXTRA_TIME];

Upvotes: 12

Related Questions