I want to know how to make "Today's date + 1 month" in Python datetime module

Asked 1 years ago, Updated 1 years ago, 101 views

How can I make one more month in date.today()?

I'm creating a program that sends messages from the client back in a month. I made a schedule with apscheduler but I forgot how to set the date after a month.

datetime python

2022-09-22 22:10

1 Answers

Try python-dateutil Adjust the number of days (28,30,31 days) on your own.

from datetime import date
from dateutil.relativedelta import relativedelta

add1m = date.today() + relativedelta(months=+1)
print(add1m)


2022-09-22 22:10

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.