Next: callig, Previous: calculator, Up: Internal Routines [Contents][Index]
calendar(date [, /fromcommon, /fromgregorian,
/fromislamic, /fromjulian, /fromjd, /fromhebrew, /fromlongcount,
/fromegyptian, /fromlunar] [, /tocommon, /togregorian, /toislamic,
/tojulian, /tojd, /tohebrew, /tomayan, /tolongcount, /toegyptian,
/tolunar, /tolatin] [, /totext, /toisotext] [, /fromutc, /fromtai,
/fromtt] [, /toutc, /totai, /tott] [, /fromymd, /fromdmy] [, /toymd,
/todmy])
Transforms date date
from one calendar system into another.
The /from…
keywords specify the source calendar system, and
the /to…
keywords the target calendar system. The input
data may be numerical or in the form of text, and likewise for the
output.
Through keywords, one can specify calendars, time systems, date component orders, and the data output type.
/...gregorian
indicates the Gregorian (modern Western) calendar. The first day of this calendar is 15 October 1582 (Gregorian), which followed directly after 4 October 1582 (Julian).
/...islamic
indicates the most widespread tabulated Islamic calendar. The first day of this calendar corresponds to 16 July 622 in the Julian calendar.
/...julian
indicates the Julian (proleptic) calendar.
/...jd
indicates the Julian day number system. Julian day number 0 corresponds to 1 January -4712 in the Julian calendar.
/...hebrew
indicates the Hebrew calendar. The first day of this calendar corresponds to 6 October -3760 in the Julian calendar.
/...common
equals /...gregorian
from 15 October 1582 (Gregorian) on and
/...julian
before then.
/tomayan
indicates the Mayan Tikal calendar round (according to "The Book of the
Year" by Munro Edmonson). /frommayan
is not available.
/tomayan
implies /totext
.
/...longcount
indicates the Olmec Long Count (according to Edmonson). Long Count
0.0.0.0.0 corresponds to 6 September -3113 in the Julian calendar.
/tolongcount
implies /totext
. /fromlongcount
only works if the input is text.
/...egyptian
indicates the Egyptian calendar used in ancient astronomy (e.g., by Ptolemy in the Almagest), with strictly 365 days per year. The year count is based on the era of Nabonassar (1 Thoth, year 1 = 26 February -746 in the Julian calendar).
/...lunar
indicates a (fractional) count of New Moons since the first New Moon after Julian Day number 0. The count is based on the mean motion of the Moon, disregarding short-term perturbations.
/tolatin
indicates the Common calendar counted the Latin way.
/totext
indicates that the dates are returned in text form, as strings, with the
(integer) day, month, and year separated by whitespace. This keyword
does not work with /tojd
.
/toisotext
indicates that the dates are returned in text form, as strings, in standard iso format: yyyy-mm-ddThh:mm:ss.
/...ymd
indicates that the components of each date are in the order year, month,
day. This keyword does not work with /...jd
.
/...dmy
indicates that the components of each date are in the order day, month,
year. This keyword does not work with /...jd
.
/...utc
indicates dates/times in Coordinated Universal Time (UTC).
/...tai
indicates dates/times in International Atomic Time (TAI).
/...tt
indicates dates/times in Terrestrial Time (TT).
The default source calendar is /fromcommon
if date
is numerical and has 3 elements in its first dimension, or if
date
contains text data. Otherwise, the default source
calendar is /fromjd
. The default target calendar is /tojd
unless the source calendar was /fromjd
, in which case the default
target calendar is /tocommon
.
With numerical input, one number is expected per date for /fromjd
and /fromlunar
, and three numbers for all other calendars.
Three-number input is interpreted by default in the order year, month,
day. For the Gregorian, Julian, Islamic, and Egyptian calendars (all of
which always have 12 months per calendar year), month and day numbers
outside of the usual ranges may be specified; month numbers are reduced
to the range of 1 - 12, adjusting the year count accordingly, and day
numbers are interpreted relative to the start of the indicated month
just like day numbers within the expected ranges. For example, the
input [232,17,43] is adjusted internally to [233,5,43], which indicates
a date 42 days after the one indicated by [233,5,1], and [232,-5,-3]
indicates a date 4 days before [231,7,1]. For most calendars, negative
and zero years may be specified.
If the input is in the form of text and /fromlongcount
is not
specified, then each string must contain a date with the day and year
written as optionally signed numbers, and the month name in characters
(not starting with a digit or a + or -). By default, the first
encountered number is taken to be the day, and the second number the
year. If the date string is incomplete, then a year, month, or day
number of 1 is assumed for the missing parts. If a single number is
specified in the text string, then it is taken to be the year number.
If an input calendar is specified, then the specified month name is
compared only to the month names associated with that calendar;
otherwise, it is compared to the month names of all calendars and the
first match is accepted. The number of month name characters that is
compared is the minimum number that is required to distinguish between
the months in the calendar: 3 for the Gregorian and Julian calendars,
4 for the Egyptian calendar, 9 for the Islamic calendar. Case is
unimportant.
For /fromlongcount
, the text input is searched for sequences of
digits separated by one or more non-digit characters. Each sequence
of digits is interpreted as a decimal number that indicates the number
of units of time at each level of the Long Count, from large to small.
There may be any (non-zero) number of levels. Each next higher level
is assumed to represent a unit of time 20 times greater than the next
lower level, except that the 3rd level is only 18 times greater than
the 2nd one. The lowest level represents days.
The default time system is /...utc
. Transformation from UTC to
TAI or TT is based on tables of leap seconds for dates between
1961-01-01 and (predicted) 1999-07-01, and on estimates for UT since
-390 for dates before 1961-01-01. (See "Explanatory Supplement to the
Astronomical Almanac", P. K. Seidelmann (editor), University Science
Books (1992), section 2.553).
Not all calendars have a new day start at the same time. For example,
in the Common calendar a new day starts at midnight, but in the Islamic
and Hebrew calendars a new day starts at sunset. Our calendar
conversion algorithms must deal with this somehow. For the traditional
calendars (all except /...jd
and /...lunar
), the
conversions are based on the integer parts of the dates only, and are
referred to noontime. The fractional part of the day is not modified.
For example, day 1 Muharram 1 A.H. (Islamic Calendar) ran from
sunset on 15 July 622 C.E. (Common Calendar) to sunset on 16 July,
so 1 Muharram 1 A.H. coincided with parts of 15 and 16 July 622 C.E.,
and 16 July 622 C.E. coincided with parts of 1 and 2 Muharram 1 A.H.
The calendar
function gives you the correspondence between these
calendars at noon. It shows that noon of 1 Muharram 1 A.H. coincided
with noon of 16 July 622 C.E.
See also: !jd, Astronomy and Calendars
Next: callig, Previous: calculator, Up: Internal Routines [Contents][Index]