summaryrefslogtreecommitdiffstats
path: root/Doc/lib/libcalendar.tex
blob: ef715f58ff9e901f5efb2563061baacce0186e1b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
\section{\module{calendar} ---
         General calendar-related functions}

\declaremodule{standard}{calendar}
\modulesynopsis{General functions for working with the calendar,
                including some emulation of the \UNIX{} \program{cal}
                program.}
\sectionauthor{Drew Csillag}{drew_csillag@geocities.com}

This module allows you to output calendars like the \UNIX{}
\program{cal} program, and provides additional useful functions
related to the calendar.

\begin{funcdesc}{isleap}{year}
Returns true if \var{year} is a leap year.
\end{funcdesc}

\begin{funcdesc}{leapdays}{year1, year2}
Return the number of leap years in the range
[\var{year1}\ldots\var{year2}].
\end{funcdesc}

\begin{funcdesc}{weekday}{year, month, day}
Returns the day of the week (\code{0} is Monday) for \var{year}
(\code{1970}--\ldots), \var{month} (\code{1}--\code{12}), \var{day}
(\code{1}--\code{31}).
\end{funcdesc}

\begin{funcdesc}{monthrange}{year, month}
Returns weekday of first day of the month and number of days in month, 
for the specified \var{year} and \var{month}.
\end{funcdesc}

\begin{funcdesc}{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.
\end{funcdesc}

\begin{funcdesc}{prmonth}{year, month\optional{, width\optional{, length}}}
Prints a month's calendar.  If \var{width} is provided, it specifies
the width of the columns that the numbers are centered in.  If
\var{length} is given, it specifies the number of lines that each
week will use.
\end{funcdesc}

\begin{funcdesc}{prcal}{year}
Prints the calendar for the year \var{year}.
\end{funcdesc}

\begin{funcdesc}{timegm}{tuple}
An unrelated but handy function that takes a time tuple such as
returned by the \function{gmtime()} function in the \refmodule{time}
module, and returns the corresponding Unix timestamp value, assuming
an epoch of 1970, and the POSIX encoding.  In fact,
\function{time.gmtime()} and \function{timegm()} are each others' inverse.
\end{funcdesc}


\begin{seealso}
  \seemodule{time}{Low-level time related functions.}
\end{seealso}