In python
how to write a program which takes a number of days from now - 100 days, and find in which month that future day is.

Recommended Answers

All 3 Replies - datetime.timedelta(days=100)

gives you the date - 100 days.

>>> import datetime
>>>, 4, 24)
>>> - datetime.timedelta(days=100), 1, 15)

You can see the month is 1.

commented: Sorry for the +1 a month late but here it is. +15

To precisely answer your question , we use a library called datetime to date related problems in python.The code below will work for you.Also it seems you are new to python so i will post a link to free tutorial of python here for beginners
Python for absolue beginners

import datetime
days=input("Enter the number of days you want to skip ahead") + datetime.timedelta(str(days))
print("The month is {}".format(new_date))
datetime_object = datetime.datetime.strptime(str(new_date.month), "%m")
month_name = datetime_object.strftime("%b")


You can refer to the programs offered by this website. rawpython

commented: Doesn't help the OP but useful nonetheless. +14
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.