This module allows you to output calendars like the Unix
cal program, and provides additional useful functions
related to the calendar. By default, these calendars have Monday as
the first day of the week, and Sunday as the last (the European
convention). Use setfirstweekday() to set the first day of the
week to Sunday (6) or to any other weekday. Parameters that specify
dates are given as integers.
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:
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().
Returns 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 set by
setfirstweekday().
Returns a 3-column calendar for an entire year as a multi-line string.
Optional parameters w, l, and c are for date column
width, lines per week, and number of spaces between month columns,
respectively. Depends on the first weekday as set by
setfirstweekday(). The earliest year for which a calendar can
be generated is platform-dependent.
An unrelated but handy function that takes a time tuple such as
returned by the gmtime() function in the time
module, and returns the corresponding Unix timestamp value, assuming
an epoch of 1970, and the POSIX encoding. In fact,
time.gmtime() and timegm() are each others' inverse.