blob: 59e344347cadb4537ebd0067b9c53ff2fa1de09a [file] [log] [blame]
Fred Drake1c127e71998-04-28 14:28:57 +00001% This section was contributed by Drew Csillag <drew_csillag@geocities.com>.
2
Fred Drake295da241998-08-10 19:42:37 +00003\section{\module{calendar} ---
4 Functions that emulate the \UNIX{} \program{cal} program.}
Fred Drakeb91e9341998-07-23 17:59:49 +00005\declaremodule{standard}{calendar}
6
Fred Drake54327c41998-07-27 22:18:24 +00007\modulesynopsis{Functions that emulate the \UNIX{} \program{cal}
8program.}
Fred Drake1c127e71998-04-28 14:28:57 +00009
10
11This module allows you to output calendars like the \UNIX{}
12\manpage{cal}{1} program.
13
14\begin{funcdesc}{isleap}{year}
15Returns \code{1} if \var{year} is a leap year.
16\end{funcdesc}
17
18\begin{funcdesc}{leapdays}{year1, year2}
19Return 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}
24Returns the day of the week (\code{0} is Monday) for \var{year}
Fred Drake02379fa1998-05-08 15:39:40 +000025(\code{1970}--\ldots), \var{month} (\code{1}--\code{12}), \var{day}
Fred Drake1c127e71998-04-28 14:28:57 +000026(\code{1}--\code{31}).
27\end{funcdesc}
28
29\begin{funcdesc}{monthrange}{year, month}
30Returns weekday of first day of the month and number of days in month,
31for the specified \var{year} and \var{month}.
32\end{funcdesc}
33
34\begin{funcdesc}{monthcalendar}{year, month}
35Returns a matrix representing a month's calendar. Each row represents
36a week; days outside of the month a represented by zeros.
37\end{funcdesc}
38
39\begin{funcdesc}{prmonth}{year, month\optional{, width\optional{, length}}}
40Prints a month's calendar. If \var{width} is provided, it specifies
41the width of the columns that the numbers are centered in. If
42\var{length} is given, it specifies the number of lines that each
43week will use.
44\end{funcdesc}
45
46\begin{funcdesc}{prcal}{year}
47Prints the calendar for the year \var{year}.
48\end{funcdesc}
Guido van Rossum47274561999-06-09 15:11:58 +000049
50\begin{funcdesc}{timegm}{tuple}
51An unrelated but handy function that takes a time tuple such are
52returned by the \function{gmtime()} function in the \module{time}
53module, and returns the corresponding Unix timestamp value, assuming
54an epoch of 1970, and the POSIX encoding. In fact,
55\function{gmtime()} and \function{timegm()} are each others inverse.
56\end{funcdesc}