Python calendar Functions

EditRocket provides the following information on calendar functions in the Python source code builder.

calendar(year[, w[, l[c]]]) - Returns a 3-column calendar for an entire year as a multi-line string using the formatyear of the TextCalendar class.

firstweekday() - Returns the current setting for the weekday to start each week.

isleap(year) - Returns True if year is a leap year, otherwise False.

leapdays(y1, y2) - Returns the number of leap years in the range [y1.

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

monthcalendar(year, month) - Returns a matrix representing a month's calendar.

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

prcal(year[, w[, l[c]]]) - Prints the calendar for an entire year as returned by calendar().

prmonth(theyear, themonth[, w[, l]]) - Prints a month's calendar as returned by month().

setfirstweekday(weekday) - Sets the weekday (0 is Monday, 6 is Sunday) to start each week.

timegm(tuple) - An unrelated but handy function that takes a time tuple such as returned by the gmtime() function in the time module.

weekday(year, month, day) - Returns the day of the week (0 is Monday) for year (1970-.

weekheader(n) - Return a header containing abbreviated weekday names.