Open In App

isocalendar() Function Of Datetime.date Class In Python

Last Updated : 28 Jul, 2021
Comments
Improve
Suggest changes
1 Like
Like
Report

The isocalendar() function is used to return a tuple containing ISO Year, ISO Week Number, and ISO Weekday.

Note:

  • 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.

Syntax: isocalendar()

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.

Output:

2021-07-25
(2021, 29, 7)

Example 2:  Get ISO Year, ISO Week Number, and ISO Weekday with a specific date.

Output:

Original date: 2020-10-11
Date in isocalendar is: (2020, 41, 7)

Next Article
Article Tags :
Practice Tags :

Similar Reads