Created
December 22, 2015 03:15
-
-
Save mortenjust/a25d0f015acbfca92704 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
func getDifferenceString(start:NSDate, end:NSDate) -> String { | |
let calendar: NSCalendar = NSCalendar.currentCalendar() | |
let components = calendar.components([.Day, .Hour, .Minute, .Second], | |
fromDate: start, | |
toDate: end, | |
options: []) | |
let d = components.day | |
let h = components.hour | |
let m = components.minute | |
let s = components.second | |
let elapsedTimeString = String(format: "%02d:%02d:%02d.%02d", arguments: [d, h, m, s]) | |
return elapsedTimeString | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment