Python Check if Today is Wednesday or not Example

Published On: 27/09/2022 | Category: Python


Hi Guys,

This tutorial will give you example of python check date is wednesday or not. we will help you to give example of python check date is wednesday. you can understand a concept of how to check if today is wednesday in python. step by step explain python today is wednesday.

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: Python Check Today's Date is Weekend or Weekday

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

Example 2: Python Check String Date is Weekend or Weekday

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

It will help you....

Happy Pythonic Coding!