Odpowiedź:
import datetime
from dateutil.relativedelta import relativedelta
def add6months(date):
date_obj = datetime.datetime.strptime(date, '%Y.%m')
new_date_obj = date_obj + relativedelta(months=+6)
return new_date_obj.strftime('%Y.%m')
date_str = input("Podaj datę w formacie RRRR.MM: ")
new_date_str = add6months(date_str)
print("Data 6 miesięcy później: ", new_date_str)
" Life is not a problem to be solved but a reality to be experienced! "
© Copyright 2013 - 2024 KUDO.TIPS - All rights reserved.
Odpowiedź:
import datetime
from dateutil.relativedelta import relativedelta
def add6months(date):
date_obj = datetime.datetime.strptime(date, '%Y.%m')
new_date_obj = date_obj + relativedelta(months=+6)
return new_date_obj.strftime('%Y.%m')
date_str = input("Podaj datę w formacie RRRR.MM: ")
new_date_str = add6months(date_str)
print("Data 6 miesięcy później: ", new_date_str)