isocalendar() Function Of Datetime.date Class In Python
The isocalendar() function is used to return a tuple containing ISO Year, ISO Week Number, and ISO Weekday.
- According to ISO standard 8601 and ISO standard 2015, Thursday is the middle day of a week.
- Therefore, ISO years always start with Monday.
- ISO years can have either 52 full weeks or 53 full weeks.
- ISO years do not have any fractional weeks during the beginning of the year or at the end of the year.
Parameters: This function does not accept any parameter.
Return values: This function returns a tuple of ISO Year, ISO Week Number and ISO Weekday.
Example 1: Get ISO Year, ISO Week Number, and ISO Weekday.
2021-07-25 (2021, 29, 7)
Example 2: Get ISO Year, ISO Week Number, and ISO Weekday with a specific date.
Original date: 2020-10-11 Date in isocalendar is: (2020, 41, 7)
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