5.9 calendar -- Functions that emulate the Unix cal program.

This module allows you to output calendars like the Unix cal(1) program.

isleap (year)
Returns 1 if year is a leap year.

leapdays (year1, year2)
Return the number of leap years in the range [year1...year2].

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

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.

prmonth (year, month[, width[, length]])
Prints a month's calendar. If width is provided, it specifies the width of the columns that the numbers are centered in. If length is given, it specifies the number of lines that each week will use.

prcal (year)
Prints the calendar for the year year.

timegm (tuple)
An unrelated but handy function that takes a time tuple such are 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, gmtime() and timegm() are each others inverse.


Send comments on this document to python-docs@python.org.


Banner.Novgorod.Ru