Isocalendar() Method Of Datetime Class In Python
The isocalendar() function is used to return a tuple of ISO Year, ISO Week Number, and ISO Weekday.
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
- 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 year can start as yearly as 29th January or as late as 4th January of a Gregorian calendar.
- 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: Using today’s dates.
2021-07-25 (2021, 29, 7)
Example 2: Using a specific date.
Original date: 2020-10-11 Date in isocalendar is: (2020, 41, 7)