Days from now

Python, Date · Oct 28, 2020

Calculates the date of n days from today.

  • Use datetime.date.today() to get the current day.
  • Use datetime.timedelta to add n days from today's date.
from datetime import timedelta, date

def days_from_now(n):
  return date.today() + timedelta(n)
days_from_now(5) # date(2020, 11, 02)

More like this

  • Days ago

    Calculates the date of n days ago from today.

    Python, Date · Oct 28, 2020

  • Date difference in days

    Calculates the day difference between two dates.

    Python, Date · Oct 28, 2020

  • Add days to date

    Calculates the date of n days from the given date.

    Python, Date · Oct 28, 2020