Created
June 11, 2019 20:06
-
-
Save popcornomnom/92157ccbe33552d0769c2fb60253dc14 to your computer and use it in GitHub Desktop.
This file contains 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 timeString(from timeInterval: TimeInterval) -> String { | |
let seconds = Int(timeInterval.truncatingRemainder(dividingBy: 60)) | |
let minutes = Int(timeInterval.truncatingRemainder(dividingBy: 60 * 60) / 60) | |
let hours = Int(timeInterval / 3600) | |
return String(format: "%.2d:%.2d:%.2d", hours, minutes, seconds | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment