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.
- 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:
- firstweekday ()
Returns the current setting for the weekday to start each week.
- isleap (year)
Returns true if year is a leap year.
- leapdays (y1, y2)
Returns the number of leap years in the range
- weekday (year, month, day)
Returns the day of the week (
0 is Monday) for year
1970-...), month (
- monthrange (year, month)
Returns weekday of first day of the month and number of days in month,
for the specified year and month.
- 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().
- prmonth (theyear, themonth[, w[, l]])
Prints a month's calendar as returned by month().
- month (theyear, themonth[, w[, l]])
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
- prcal (year[, w[, l[c]]])
Prints the calendar for an entire year as returned by
- calendar (year[, w[, l[c]]])
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
- timegm (tuple)
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.
Más informació en:
- Module time:
- Low-level time related functions.
Ver Sobre este documento... para obtener información sobre sugerencias.