chrono.calendar.ISOCalendar - ISO 8601 calendar functionality

class chrono.calendar.ISOCalendar

An ISO calendar, with functionality conforming to the ISO 8601 standard.

Characteristics of the ISO calendar, compared to the Gregorian:

  • Weeks start on Monday
  • The first week of a year is the week containing the first Thursday
classmethod fullyear(year)

Converts a short 2-digit year to a full 4-digit year. year will be interpreted to be in range 1930-2029.

Raises chrono.error.YearError if year is invalid.

classmethod leapyear(year)

Returns True if year is a leap year, otherwise False.

Raises chrono.error.YearError if year is invalid.

classmethod monthdays(year, month)

Returns the number of days in month. year is needed to handle leap years.

Raises chrono.error.YearError or chrono.error.MonthError if year or month is invalid.

classmethod monthname(month, short=False)

Returns the name of month, according to the current system locale. If short is True, returns the abbreviated month name.

Raises chrono.error.MonthError if month is invalid.

classmethod ordinal(year, month, day)

Returns the ordinal day for the given date.

Raises chrono.error.YearError, chrono.error.MonthError or chrono.error.DayError if year, month or day is invalid.

classmethod ordinal_to_date(year, day)

Converts an ordinal day to a date, returned as a tuple of year, month, and day.

Raises chrono.error.YearError or chrono.error.DayError if year or day is invalid.

classmethod validate(year, month, day)

Validates a date: year must be in range 1-9999, month in range 1-12, and day in range 1-31, depending on year and month.

Raises chrono.error.YearError, chrono.error.MonthError or chrono.error.DayError on invalid input.

classmethod validate_month(month)

Validates month: must be in range 1-12.

Raises chrono.error.MonthError on invalid input.

classmethod validate_ordinal(year, day)

Validates an ordinal date: year must be in range 1-9999, day must be in range 1-365, or 366 if year is a leap year.

Raises chrono.error.YearError or chrono.error.DayError on invalid input.

classmethod validate_week(year, week)

Validates a week: year must be in range 1-9999, and week must be in range 1-53, depending on year.

Raises chrono.error.YearError or chrono.error.WeekError if year or week is invalid.

classmethod validate_weekdate(year, week, weekday)

Validates a weekdate: year must be in range 1-9999, week must be in range 1-53, depending on year, and weekday must be in range 1-7.

Raises chrono.error.YearError, chrono.error.WeekError, or chrono.error.DayError if year, week, or weekday is invalid.

classmethod validate_weekday(day)

Validates a week day: day must be in range 1-7.

Raises chrono.error.DayError if day is invalid.

classmethod validate_year(year)

Validates year: must be in range 1-9999.

Raises chrono.error.YearError if year is invalid.

classmethod week(year, month, day)

Returns the week containing the given date as a tuple of year and week.

Raises chrono.error.YearError, chrono.error.MonthError, or chrono.error.DayError if year, month, or day is invalid.

classmethod week_to_date(year, week)

Returns the date of the first day in the given week as a tuple of year, month, and day.

Raises chrono.error.YearError or chrono.error.WeekError if year or week is invalid.

classmethod weekdate(year, month, day)

Returns the weekdate for the given date as a tuple with year, week, and weekday.

Raises chrono.error.YearError, chrono.error.MonthError, or chrono.error.DayError if year, month, or day is invalid.

classmethod weekdate_to_date(year, week, day)

Returns the date of the given weekdate as a tuple with year, month, and day.

Raises chrono.error.YearError, chrono.error.WeekError, or chrono.error.DayError if year, week, or day is invalid.

classmethod weekday(year, month, day)

Returns the weekday of the given date.

Raises chrono.error.YearError, chrono.error.MonthError, or chrono.error.DayError if year, month, or day is invalid.

classmethod weekdayname(weekday, short=False)

Returns the weekday name of the given weekday. If short is True, returns the abbreviated weekday name.

Raises chrono.error.DayError if weekday is invalid.

classmethod weeks(year)

Returns the number of weeks in year.

Raises chrono.error.YearError if year is invalid.

classmethod yeardays(year)

Returns the number of days in year.

Raises chrono.error.YearError if year is invalid.

Previous topic

chrono.calendar.Calendar - Base class for calendars

Next topic

chrono.calendar.USCalendar - US calendar functionality