Advertisement
Guest User

Untitled

a guest
Nov 28th, 2015
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. extension NSDate {
  2.  
  3. func isGreaterThanDate(dateToCompare : NSDate) -> Bool {
  4. return self.compare(dateToCompare) == NSComparisonResult.OrderedDescending
  5. }
  6.  
  7.  
  8. func isLessThanDate(dateToCompare : NSDate) -> Bool {
  9. return self.compare(dateToCompare) == NSComparisonResult.OrderedAscending
  10. }
  11.  
  12. func addDays(daysToAdd : Int) -> NSDate
  13. {
  14. let secondsInDays : NSTimeInterval = Double(daysToAdd) * 60 * 60 * 24
  15.  
  16. return self.dateByAddingTimeInterval(secondsInDays)
  17. }
  18.  
  19.  
  20. func addHours(hoursToAdd : Int) -> NSDate
  21. {
  22. let secondsInHours : NSTimeInterval = Double(hoursToAdd) * 60 * 60
  23.  
  24. return self.dateByAddingTimeInterval(secondsInHours)
  25. }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement