Get First Date of Next Month in Python

Sep 15, 2022

.

Admin

Get First Date of Next Month in Python

Hi Dev,

This article will provide example of Get First Date of Next Month in Python. Here you will learn get Next Month Date in python. This post will give you simple example of Get Next Month First Date in Python. I explained simply about How to Get Next Month First Date in Python. Let's get started with Python Get Next Month Date.

In this example, I will give you a simple example of getting the first date of next month using datetime and relativedelta. so let's see a simple example with output.

so let's see following examples with output:

Example


main.py

import datetime

from dateutil import relativedelta

today = datetime.date.today()

# Getting Next Month First Date

nextMonthDate = today + relativedelta.relativedelta(months=1, day=1)

print(nextMonthDate);

Output:

2022-10-01

#Python