weekday() Function Of Datetime.date Class In Python
The weekday() of datetime.date class function is used to return the integer value corresponding to the specified day of the week.
Parameters: This function does not accept any parameter.
Return values: This function returns the integer mapping corresponding to the specified day of the week. Below table shows the integer values corresponding to the day of the week.
|Integer returned by weekday() function||Day of the week|
Example 1: Getting the integer values corresponding to the specified days of the week.
6 0 1
Example 2: Getting the date and time along with the day’s name of the entire week.
2021-08-02 00:00:00 is for Monday 2021-08-03 00:00:00 is for Tuesday 2021-08-04 00:00:00 is for Wednesday 2021-08-05 00:00:00 is for Thursday 2021-08-06 00:00:00 is for Friday 2021-08-07 00:00:00 is for Saturday 2021-08-08 00:00:00 is for Sunday
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