ItSolutionStuff.com

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

By Hardik Savani • October 30, 2023
Python

This simple article demonstrates of python check date is saturday. step by step explain how to check if today is saturday in python. I explained simply about how to check if today is saturday in python. if you want to see example of python today is saturday then you are a right place.

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

Output:

Yes, Today is Saturday

Example 2:

main.py

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

Output:

 
Yes, Today is Saturday

I hope it can help you...

Tags: Python
Hardik Savani

Hardik Savani

I'm a full-stack developer, entrepreneur, and founder of ItSolutionStuff.com. Passionate about PHP, Laravel, JavaScript, and helping developers grow.

📺 Subscribe on YouTube

We Are Recommending You

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

Read Now →

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

Read Now →

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

Read Now →

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

Read Now →

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

Read Now →

Python Check if Date is Weekend or Weekday Example

Read Now →

Python Subtract Minutes from DateTime Example

Read Now →

Python POST Request with Parameters Example

Read Now →