When I searched, only the second pattern was caught, and there was another solution, so I made a note.
python
import datetime
import calendar
dt = datetime.datetime.today()
max_day = calendar.monthrange(dt.year, dt.month)[1]
nm = datetime.date(dt.year, dt.month, max_day) + datetime.timedelta(days=1)
python
import datetime
from dateutil.relativedelta import relativedelta
dt = datetime.datetime.today()
nm = dt + relativedelta(months=1)
Recommended Posts