Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@parzibyte
Last active August 18, 2021 22:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save parzibyte/a31a84c2631da3e9e7a16193b15068c5 to your computer and use it in GitHub Desktop.
Save parzibyte/a31a84c2631da3e9e7a16193b15068c5 to your computer and use it in GitHub Desktop.
from datetime import datetime
navidad = datetime.strptime("2021-12-25", "%Y-%m-%d")
fin_anio = datetime.strptime("2021-12-31", "%Y-%m-%d")
diferencia = fin_anio-navidad
print(f"La diferencia es de {diferencia.days} días y {diferencia.seconds} segundos. La diferencia total es de {diferencia.total_seconds()} segundos")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment