-2

I want to make a function that returns the expiration date. this is the field to calculate from?

delivery_date = models.DateTimeField(auto_now_add=True)
i Osama
  • 17
  • 4

1 Answers1

1

this is how to do it in python:

from datetime import date
from dateutil.relativedelta import relativedelta

date_of_interest = date.today() # get this from your app
eight_months = date_of_interest + relativedelta(months=+8)

print(date_of_interest)
print(eight_months)

from: How do I calculate the date six months from the current date using the datetime Python module?

Brian Z
  • 343
  • 1
  • 8