Isoweekday() Function Of Datetime.date Class In Python
isoweekday() is a function that returns an integer that tells the given date falls on. The integer it returns represents a day according to the table given below.
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course. And to begin with your Machine Learning Journey, join the Machine Learning - Basic Level Course
Return Value: an integer in range of [1,7]
|Integer Returned||Day of the week|
Example 1: This program grabs the date using the DateTime module and tells the day of the date.
Current Date is : 2021-08-18 The date 2021-08-18 falls on Wednesday
Example 2: In this example, we will take the user’s input for a date and will return the day it falls on.
The given date 2020-09-18 falls on Friday
Example 3: In this example, we will take the user’s input for the date and the day that it falls on and return if that’s true or not
Yes, your given date 2021-01-01 falls on your expected day i.e Friday