This file contains hidden or 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
| from dateutil.easter import * | |
| from dateutil.relativedelta import * | |
| from dateutil.rrule import * | |
| from dateutil.parser import * | |
| from datetime import * | |
| # pip install python-dateutil | |
| fecha-actual = datetime.today() | |
| johnbirthday = datetime(2017, 10, 15, 10, 25) | |
| resultado = relativedelta(fecha-actual, johnbirthday) |
This file contains hidden or 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
| from datetime import datetime, date | |
| formato_fecha = "%Y-%m-%d %H:%M:%S" | |
| fecha = datetime.today() | |
| fecha_actual= fecha.strftime(formato_fecha) | |
| fecha_inicial = datetime.strptime("2017-10-10 03:12:50",formato_fecha) | |
| fecha_final = datetime.strptime(fecha_actual, formato_fecha) | |
| diferencia = fecha_final - fecha_inicial |