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

By Hardik Savani October 30, 2023 Category : Python

In this example, I will show you python check date is thursday. you can see how to check if today is thursday in python. This article will give you simple example of how to check if today is thursday in python. it's simple example of python today is thursday. So, let's follow few step to create example of check today is thursday in python.

In this example, we will use DateTime library to check whether today is Thursday 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 Thursday (0 = Mon, 1 = Tue, 2 = Wen ...)
if datetime.today().weekday() == 3:
    print("Yes, Today is Thursday")
else:
    print("Nope...")

Output:

Yes, Today is Thursday

Example 2:

main.py

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

Output:

 
Yes, Today is Thursday

I hope it can help you...

Tags :
Shares