Skip to content

Instantly share code, notes, and snippets.

@toddhopkinson
Last active September 16, 2016 23:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save toddhopkinson/9219f1abc7da48eb9d28bafe2c9eb767 to your computer and use it in GitHub Desktop.
Save toddhopkinson/9219f1abc7da48eb9d28bafe2c9eb767 to your computer and use it in GitHub Desktop.
Days past since date
let birthday = Todd.birthday // gets my birthday
let now = NSDate()
let secondsDifference = now.timeIntervalSinceDate(birthday)
let secondsPerDay = 60*60*24 // 60 seconds * 60 minutes * 24 hours
let daysSinceBirthday = secondsDifference / secondsPerDay
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment