Skip to content

Instantly share code, notes, and snippets.

@hayakawatomoaki
Last active August 29, 2015 14:15
Show Gist options
  • Save hayakawatomoaki/c94a44991538a5793b0f to your computer and use it in GitHub Desktop.
Save hayakawatomoaki/c94a44991538a5793b0f to your computer and use it in GitHub Desktop.
Swiftで現在からの経過時間を計算するNSDateのExtension ref: http://qiita.com/hayakawatomoaki/items/8f1d5aeb74ba2156245c
var c = "2015-02-06 19:48:31".toDate(format: "yyyy-M-d HH:mm:ss")?.stringForTimeIntervalSinceCreated() // optional
println(c) // Optional("5 days")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment