-
-
Save parzibyte/3a5924edd6d9b804e669071ef15ae7ca 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
# https://parzibyte.me/blog | |
from datetime import datetime, timedelta | |
def obtener_tiempo_transcurrido(segundos): | |
dias = int(segundos / 60 / 60 / 24) | |
segundos -= dias * 60 * 60 * 24 | |
horas = int(segundos / 60 / 60) | |
segundos -= horas*60*60 | |
minutos = int(segundos/60) | |
segundos -= minutos*60 | |
return f"{dias} días, {horas} horas, {minutos} minutos y {segundos} segundos" | |
ahora = datetime.now() | |
futuro = ahora + timedelta(hours=50, seconds=925) | |
diferencia = futuro-ahora | |
legible = obtener_tiempo_transcurrido(diferencia.total_seconds()) | |
print(legible) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment