def suma_mes(current_date, month_step):
""" suma month_setp mesos a current_date """
carry, new_month=divmod(current_date.month-1+month_step, 12)
new_month+=1
return current_date.replace(year=current_date.year+carry, month=new_month)
¿Cuántos días faltan para el mismo día de hoy del mes que viene?
>>> print (suma_mes(datetime.date.today(), 1)-datetime.date.today()).days
No hay comentarios:
Publicar un comentario