calendar.TextCalendar

class calendar.TextCalendar(firstweekday=0) This class can be used to generate plain text calendars. TextCalendar instances have the following methods: formatmonth(theyear, themonth, w=0, l=0) Return a month’s calendar in a multi-line string. If w is provided, it specifies the width of the date columns, which are centered. If l is given, it specifies the number of lines that each week will use. Depends on the first weekday as specified in the constructor or set by the setfirstweekday() me

calendar.setfirstweekday()

calendar.setfirstweekday(weekday) Sets the weekday (0 is Monday, 6 is Sunday) to start each week. The values MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY, and SUNDAY are provided for convenience. For example, to set the first weekday to Sunday: import calendar calendar.setfirstweekday(calendar.SUNDAY)

calendar.prmonth()

calendar.prmonth(theyear, themonth, w=0, l=0) Prints a month’s calendar as returned by month().

calendar.prcal()

calendar.prcal(year, w=0, l=0, c=6, m=3) Prints the calendar for an entire year as returned by calendar().

calendar.month_name

calendar.month_name An array that represents the months of the year in the current locale. This follows normal convention of January being month number 1, so it has a length of 13 and month_name[0] is the empty string.

calendar.month_abbr

calendar.month_abbr An array that represents the abbreviated months of the year in the current locale. This follows normal convention of January being month number 1, so it has a length of 13 and month_abbr[0] is the empty string.

calendar.monthrange()

calendar.monthrange(year, month) Returns weekday of first day of the month and number of days in month, for the specified year and month.

calendar.monthcalendar()

calendar.monthcalendar(year, month) Returns a matrix representing a month’s calendar. Each row represents a week; days outside of the month a represented by zeros. Each week begins with Monday unless set by setfirstweekday().

calendar.month()

calendar.month(theyear, themonth, w=0, l=0) Returns a month’s calendar in a multi-line string using the formatmonth() of the TextCalendar class.

calendar.LocaleTextCalendar

class calendar.LocaleTextCalendar(firstweekday=0, locale=None) This subclass of TextCalendar can be passed a locale name in the constructor and will return month and weekday names in the specified locale. If this locale includes an encoding all strings containing month and weekday names will be returned as unicode.