Navigation

Operators and Keywords

Function List:

C++ API

: c = calendar ()
: c = calendar (d)
: c = calendar (y, m)
: calendar (…)

Return the current monthly calendar in a 6x7 matrix.

If d is specified, return the calendar for the month containing the date d, which must be a serial date number or a date string.

If y and m are specified, return the calendar for year y and month m.

If no output arguments are specified, print the calendar on the screen instead of returning a matrix.

See also: datenum, datestr.

Demonstration 1

The following code

 ## Calendar for current month
 calendar ()

Produces the following output

Jan 2017
     S     M    Tu     W    Th     F     S
     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     0     0     0     0
     0     0     0     0     0     0     0

Demonstration 2

The following code

 ## Calendar for October, 1957
 calendar (1957, 10)

Produces the following output

Oct 1957
     S     M    Tu     W    Th     F     S
     0     0     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     0     0
     0     0     0     0     0     0     0

Package: octave