Advertisement
Fhernd

convertir-string-a-datetime.py

Jan 21st, 2018
1,114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.23 KB | None | 0 0
  1. import datetime
  2.  
  3. # Crear una fecha arbitraria:
  4. fin_aghnio = datetime.datetime(year = 2017, month = 12, day = 31)
  5. print(fin_aghnio)
  6.  
  7. # Uso función strptime:
  8. fecha = datetime.datetime.strptime("2017-12-31", "%Y-%m-%d")
  9. print(fecha)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement