# How to find the difference or gap of days between two dates in python

In this tutorial, We will seeĀ **How to find the difference or gap of days between two dates in python. **So Guy’s, No need to fear about it that how we will solve this problem. Here, I am going to provide** a simple solution** to this problem in python by using **datetime module. **In order to solve this problem in python language, we have to know datetime module in python language.

You may also like to read:

**What is datetime module in python?**

Python provide inbuilt module datetime which allow us to solve various problem related to date and time.

## To find the difference or gap of days between two dates in Python

So, let’s start to understand this problem in easy ways. We will follow these steps in python language:

1. First of all, we will include the date in our python program from datetime module by using import function.

from datetime import date

2. We will take the starting date and the ending date of calendar between which you have to find the difference or gap of days.

Start=date(2019,7,1) End=date(2019,8,15)

3. Now, we will find the difference or gap of days between two dates as we have learned to Subtract two number by using minus sign (-) and print gap of days on output page.

Gap=(End-Start).days print("Days gap:") print(Gap)

#### Python program to find difference or gap of days

Python program:

from datetime import date Start=date(2019,7,1) End=date(2019,8,15) Gap=(End-Start).days print("Days gap:") print(Gap)

Output of code:

Days gap: 45

So Guy’s, I hope you really enjoy this tutorial and feel free to leave a comment if you have any doubt.

## Leave a Reply