Fred Drake | 295da24 | 1998-08-10 19:42:37 +0000 | [diff] [blame] | 1 | \section{\module{calendar} --- |
Fred Drake | 38e5d27 | 2000-04-03 20:13:55 +0000 | [diff] [blame] | 2 | General calendar-related functions} |
| 3 | |
Fred Drake | b91e934 | 1998-07-23 17:59:49 +0000 | [diff] [blame] | 4 | \declaremodule{standard}{calendar} |
Fred Drake | 38e5d27 | 2000-04-03 20:13:55 +0000 | [diff] [blame] | 5 | \modulesynopsis{General functions for working with the calendar, |
| 6 | including some emulation of the \UNIX{} \program{cal} |
| 7 | program.} |
| 8 | \sectionauthor{Drew Csillag}{drew_csillag@geocities.com} |
Fred Drake | 1c127e7 | 1998-04-28 14:28:57 +0000 | [diff] [blame] | 9 | |
| 10 | This module allows you to output calendars like the \UNIX{} |
Fred Drake | 38e5d27 | 2000-04-03 20:13:55 +0000 | [diff] [blame] | 11 | \program{cal} program, and provides additional useful functions |
| 12 | related to the calendar. |
Fred Drake | 1c127e7 | 1998-04-28 14:28:57 +0000 | [diff] [blame] | 13 | |
| 14 | \begin{funcdesc}{isleap}{year} |
Fred Drake | 38e5d27 | 2000-04-03 20:13:55 +0000 | [diff] [blame] | 15 | Returns true if \var{year} is a leap year. |
Fred Drake | 1c127e7 | 1998-04-28 14:28:57 +0000 | [diff] [blame] | 16 | \end{funcdesc} |
| 17 | |
| 18 | \begin{funcdesc}{leapdays}{year1, year2} |
| 19 | Return the number of leap years in the range |
| 20 | [\var{year1}\ldots\var{year2}]. |
| 21 | \end{funcdesc} |
| 22 | |
| 23 | \begin{funcdesc}{weekday}{year, month, day} |
| 24 | Returns the day of the week (\code{0} is Monday) for \var{year} |
Fred Drake | 02379fa | 1998-05-08 15:39:40 +0000 | [diff] [blame] | 25 | (\code{1970}--\ldots), \var{month} (\code{1}--\code{12}), \var{day} |
Fred Drake | 1c127e7 | 1998-04-28 14:28:57 +0000 | [diff] [blame] | 26 | (\code{1}--\code{31}). |
| 27 | \end{funcdesc} |
| 28 | |
| 29 | \begin{funcdesc}{monthrange}{year, month} |
| 30 | Returns weekday of first day of the month and number of days in month, |
| 31 | for the specified \var{year} and \var{month}. |
| 32 | \end{funcdesc} |
| 33 | |
| 34 | \begin{funcdesc}{monthcalendar}{year, month} |
| 35 | Returns a matrix representing a month's calendar. Each row represents |
| 36 | a week; days outside of the month a represented by zeros. |
| 37 | \end{funcdesc} |
| 38 | |
| 39 | \begin{funcdesc}{prmonth}{year, month\optional{, width\optional{, length}}} |
| 40 | Prints a month's calendar. If \var{width} is provided, it specifies |
| 41 | the width of the columns that the numbers are centered in. If |
| 42 | \var{length} is given, it specifies the number of lines that each |
| 43 | week will use. |
| 44 | \end{funcdesc} |
| 45 | |
| 46 | \begin{funcdesc}{prcal}{year} |
| 47 | Prints the calendar for the year \var{year}. |
| 48 | \end{funcdesc} |
Guido van Rossum | 4727456 | 1999-06-09 15:11:58 +0000 | [diff] [blame] | 49 | |
| 50 | \begin{funcdesc}{timegm}{tuple} |
Fred Drake | 38e5d27 | 2000-04-03 20:13:55 +0000 | [diff] [blame] | 51 | An unrelated but handy function that takes a time tuple such as |
| 52 | returned by the \function{gmtime()} function in the \refmodule{time} |
Guido van Rossum | 4727456 | 1999-06-09 15:11:58 +0000 | [diff] [blame] | 53 | module, and returns the corresponding Unix timestamp value, assuming |
| 54 | an epoch of 1970, and the POSIX encoding. In fact, |
Fred Drake | 38e5d27 | 2000-04-03 20:13:55 +0000 | [diff] [blame] | 55 | \function{time.gmtime()} and \function{timegm()} are each others' inverse. |
Guido van Rossum | 4727456 | 1999-06-09 15:11:58 +0000 | [diff] [blame] | 56 | \end{funcdesc} |
Fred Drake | 38e5d27 | 2000-04-03 20:13:55 +0000 | [diff] [blame] | 57 | |
| 58 | |
| 59 | \begin{seealso} |
| 60 | \seemodule{time}{Low-level time related functions.} |
| 61 | \end{seealso} |