Created
November 28, 2015 21:59
-
-
Save ppeelen/e71c4dd1c3070b3549be to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension NSDate { | |
func isGreaterThanDate(dateToCompare : NSDate) -> Bool { | |
return self.compare(dateToCompare) == NSComparisonResult.OrderedDescending | |
} | |
func isLessThanDate(dateToCompare : NSDate) -> Bool { | |
return self.compare(dateToCompare) == NSComparisonResult.OrderedAscending | |
} | |
func addDays(daysToAdd : Int) -> NSDate | |
{ | |
let secondsInDays : NSTimeInterval = Double(daysToAdd) * 60 * 60 * 24 | |
return self.dateByAddingTimeInterval(secondsInDays) | |
} | |
func addHours(hoursToAdd : Int) -> NSDate | |
{ | |
let secondsInHours : NSTimeInterval = Double(hoursToAdd) * 60 * 60 | |
return self.dateByAddingTimeInterval(secondsInHours) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment