Explore Courses Blog Tutorials Interview Questions
0 votes
1 view
in Python by (47.6k points)

I am using the datetime Python module. I am looking to calculate the date 6 months from the current date. Could someone give me a little help doing this?

The reason I want to generate a date of 6 months from the current date is to produce a review date. If the user enters data into the system it will have a review date of 6 months from the date they entered the data.


1 Answer

0 votes
by (106k points)

To calculate the date six months from the current date you can do by using the datetime Python module below is the code for the same:-

from datetime import date

from dateutil.relativedelta import relativedelta

six_months = + relativedelta(months=+6)



Another thing you can do is to get the date after six months from the current date is by using the following method:-

import datetime

print ( + datetime.timedelta(6*365/12)).isoformat()

Welcome to Intellipaat Community. Get your technical queries answered by top developers!

28.4k questions

29.7k answers


94.1k users

Browse Categories