How to Check if Today is Monday or not in Python?

By Hardik Savani October 30, 2023 Category : Python

Hi,

In this article we will cover on how to implement python check date is monday. you will learn how to check if today is monday in python. you will learn how to check if today is monday in python. I would like to show you python today is monday.

In this example, we will use DateTime library to check whether today is Monday or not. I will give you two simple examples one using weekday() and another using isoweekday(). so let's see both examples:

You can use these examples with python3 (Python 3) version.

Example 1:

main.py

from datetime import datetime
  
# If today is Monday (0 = Mon, 1 = Tue, 2 = Wen ...)
if datetime.today().weekday() == 0:
    print("Yes, Today is Monday")
else:
    print("Nope...")

Output:

Yes, Today is Monday

Example 2:

main.py

from datetime import datetime
  
# If today is Monday (1 = Mon, 2 = Tue, 3 = Wen ...)
if datetime.today().isoweekday() == 1:
    print("Yes, Today is Monday")
else:
    print("Nope...")

Output:

 
Yes, Today is Monday

I hope it can help you...

Tags :
Shares