Question:
I need to compare 2 times - the current time and a set one. If the set time is in the future, find out how many minutes remain until said future time.
just to add to @tyt_g207's answer, I found the compare method, but hadn't found NSComparisonResult.OrderedDescending
and the others. I used something like the modified below to check an expiration date against today's date
let date1 : NSDate = expirationDate
let date2 : NSDate = NSDate() //initialized by default with the current date
let compareResult = date1.compare(date2)
if compareResult == NSComparisonResult.OrderedDescending {
println("\(date1) is later than \(date2)")
}
let interval = date1.timeIntervalSinceDate(date2)