Created
April 23, 2020 16:22
-
-
Save parzibyte/e12ffbdfaeeae46b07eee1f19588c874 to your computer and use it in GitHub Desktop.
This file contains 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
""" | |
Comienza el uso de relativedelta. Recuerda instalar con: | |
pip install python-dateutil | |
""" | |
dentro_de_un_mes = ahora + relativedelta(months=1) | |
print("Dentro de un mes: " + str(dentro_de_un_mes)) | |
dentro_de_anio_y_semana = ahora + relativedelta(years=1, weeks=1) | |
print("Dentro de un año y una semana: " + str(dentro_de_anio_y_semana)) | |
# Sumar pero con negativos, obteniendo una resta | |
hace_dos_anios = ahora + relativedelta(years=-2) | |
print("Hace dos años: " + str(hace_dos_anios)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment