Skip to content

Instantly share code, notes, and snippets.

@Fhernd
Created June 5, 2018 12:19
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 Fhernd/ff0c23f67f29c61ff97daf8f6398538c to your computer and use it in GitHub Desktop.
Save Fhernd/ff0c23f67f29c61ff97daf8f6398538c to your computer and use it in GitHub Desktop.
Conversión de tiempo. OrtizOL.
from datetime import timedelta
from datetime import datetime
tiempo1 = timedelta(days=5, hours=7)
tiempo2 = timedelta(hours=3.5)
tiempo3 = tiempo1 + tiempo2
print(tiempo3.days)
print(tiempo3.seconds)
print(tiempo3.seconds / 3600)
print(tiempo3.total_seconds() / 3600)
print('')
tiempo1 = datetime(2018, 6, 5)
print(tiempo1 + timedelta(days=14))
tiempo2 = datetime(2013, 4, 13)
tiempo3 = tiempo1 - tiempo2
print(tiempo3.days)
print('')
ahora = datetime.today()
print(ahora)
print(ahora + timedelta(minutes=13))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment