Last active
April 9, 2020 14:14
-
-
Save ogiovannyoliveira/899d9a9f79d4ebac98f4826441f0ef8c to your computer and use it in GitHub Desktop.
Transformando segundos em dias, horas, minutos e segundos
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
int segundos = 86400; | |
int days = (segundos / 86400).floor(); | |
int hours = ((segundos - (days * 86400)) / 3600).floor(); | |
int minutes; | |
int seconds; | |
minutes = ((segundos - (days * 86400) - (hours * 3600)) / 60).floor(); | |
seconds = (segundos - (days * 86400) - (hours * 3600) - (minutes * 60)).floor(); | |
// .floor() -> arredonda valores quebrados |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment