Python Check if Today is Sunday or not Example

Published On: 03/10/2022 | Category: Python


Hi Guys,

This article will provide some of the most important example python check date is sunday or not. I’m going to show you about python check date is sunday. This article will give you simple example of how to check if today is sunday in python. I explained simply step by step how to check if today is sunday in python. Follow bellow tutorial step of python today is sunday.

In this example, we will use DateTime library to check whether today is Tuesday 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.

So let's see bellow example:

Example 1:

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

Example 2:

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

It will help you....

Happy Pythonic Coding!