Created
March 10, 2016 09:55
-
-
Save atika/84f53267f3b3424e75db to your computer and use it in GitHub Desktop.
Convert seconds to days, hours, minutes, seconds in Swift
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
let seconds = 86400*4 + 3600*2 + 65 | |
print(String((seconds / 86400)) + " days") | |
print(String((seconds % 86400) / 3600) + " hours") | |
print(String((seconds % 3600) / 60) + " minutes") | |
print(String((seconds % 3600) % 60) + " seconds") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment