Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Swift Dates plyground
var date = NSDate()
var yesterday = date.dateByAddingTimeInterval(-24 * 60 * 60)
var dateComparisonResult: NSComparisonResult =
if dateComparisonResult == NSComparisonResult.OrderedAscending {
println("date is smaller than yesterday")
} else if dateComparisonResult == NSComparisonResult.OrderedDescending {
println("date is larger than yesterday")
} else {
println("Both dates are the smae")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.