Skip to content

Instantly share code, notes, and snippets.

@juanPaclan
juanPaclan / gist:f618e49cffd17b21296bbefafbe6d100
Last active July 17, 2019 22:37
diferencia de fecha python
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
@juanPaclan
juanPaclan / diferencia de fechas
Last active October 16, 2017 20:57
instalar pytho-dateutil
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)