An ordinal date is a
calendar date
A calendar date is a reference to a particular day represented within a calendar system. The calendar date allows the specific day to be identified. The number of days between two dates may be calculated. For example, "25 " is ten days after " ...
typically consisting of a ''
year
A year or annus is the orbital period of a planetary body, for example, the Earth, moving in its orbit around the Sun. Due to the Earth's axial tilt, the course of a year sees the passing of the seasons, marked by change in weather, the hou ...
'' and a day of the year or ordinal day number (or simply ordinal day or day number), an
ordinal number
In set theory, an ordinal number, or ordinal, is a generalization of ordinal numerals (first, second, th, etc.) aimed to extend enumeration to infinite sets.
A finite set can be enumerated by successively labeling each element with the least n ...
ranging between 1 and 366 (starting on January 1), though year may sometimes be omitted. The two numbers can be formatted as YYYY-DDD to comply with the
ISO 8601 ordinal date format.
Nomenclature
''Ordinal date'' is the preferred name for what was formerly called the ''"Julian date"'' or , or , which still seen in old programming languages and spreadsheet software. The older names are deprecated because they are easily confused with the earlier dating system called ''
Julian day number
The Julian day is the continuous count of days since the beginning of the Julian period, and is used primarily by astronomers, and in software for easily calculating elapsed days between two events (e.g. food production date and sell by date).
...
'' or , which was in prior use and which remains ubiquitous in astronomical and some historical calculations.
Calculation
Computation of the ordinal day within a year is part of calculating the ordinal day throughout the years from a
reference date, such as the
Julian date
The Julian day is the continuous count of days since the beginning of the Julian period, and is used primarily by astronomers, and in software for easily calculating elapsed days between two events (e.g. food production date and sell by date).
...
. It is also part of
calculating the day of the week
The determination of the day of the week for any date may be performed with a variety of algorithms. In addition, perpetual calendars require no calculation by the user, and are essentially lookup tables.
A typical application is to calculate the ...
, though for this purpose modulo 7 simplifications can be made.
In the following text, several algorithms for calculating the ordinal day is presented. The inputs taken are integers , and , for the year, month, and day numbers of the Gregorian or Julian calendar date.
Trivial methods
The most trivial method of calculating the ordinal day involves counting up all days that have elapsed per the definition:
# Let ''O'' be 0.
# From , add the length of month to ''O'', taking care of leap year according to the calendar used.
# Add ''d'' to ''O''.
Similarly trivial is the use of a lookup table, such as the one referenced.
Zeller-like
The table of month lengths can be replaced following the method of encoding the month-length variation in
Zeller's congruence Zeller's congruence is an algorithm devised by Christian Zeller in the 19th century to calculate the day of the week for any Julian calendar, Julian or Gregorian calendar date. It can be considered to be based on the conversion between Julian day an ...
. As in Zeller, the is changed to if . It can be shown (see below) that for a month-number , the total days of the preceding months is equal to . As a result, the March 1-based ordinal day number is .
The formula reflects the fact that any five consecutive months in the range March–January have a total length of 153 days, due to a fixed pattern 31–30–31–30–31 repeating itself twice. This is similar to encoding of the month offset (which would be the same sequence modulo 7) in
Zeller's congruence Zeller's congruence is an algorithm devised by Christian Zeller in the 19th century to calculate the day of the week for any Julian calendar, Julian or Gregorian calendar date. It can be considered to be based on the conversion between Julian day an ...
. As is 30.6, the sequence oscillates in the desired pattern with the desired period 5.
To go from the March 1 based ordinal day to a January 1 based ordinal day:
* For (March through December), where is a function returning 0 or 1 depending whether the input is a leap year.
* For January and February, two methods can be used:
*# The trivial method is to skip the calculation of and go straight for for January and for February.
*# The less redundant method is to use , where 306 is the number of dates in March through December. This makes use of the fact that the formula correctly gives a month-length of 31 for January.
"
Doomsday
Doomsday may refer to:
* Eschatology, a time period described in the eschatological writings in Abrahamic religions and in doomsday scenarios of non-Abrahamic religions.
* Global catastrophic risk, a hypothetical event explored in science and fict ...
" properties:
For
and
we get
:
giving consecutive differences of 63 (9 weeks) for 3, 4, 5, and 6, i.e., between 4/4, 6/6, 8/8, 10/10, and 12/12.
For
and
we get
:
and with ''m'' and ''d'' interchanged
:
giving a difference of 119 (17 weeks) for (difference between 5/9 and 9/5), and also for (difference between 7/11 and 11/7).
Table
For example, the ordinal date of April 15 is in a common year, and in a
leap year
A leap year (also known as an intercalary year or bissextile year) is a calendar year that contains an additional day (or, in the case of a lunisolar calendar, a month) added to keep the calendar year synchronized with the astronomical year or s ...
.
Month–day
The number of the month and date is given by
:
:
the term
can also be replaced by
with
the ordinal date.
*Day 100 of a common year:
::
::
:April 10.
*Day 200 of a common year:
::
::
:July 19.
*Day 300 of a leap year:
::
::
:November - 5 = October 26 (31 - 5).
See also
*
Julian day
The Julian day is the continuous count of days since the beginning of the Julian period, and is used primarily by astronomers, and in software for easily calculating elapsed days between two events (e.g. food production date and sell by date).
...
*
Zeller's congruence Zeller's congruence is an algorithm devised by Christian Zeller in the 19th century to calculate the day of the week for any Julian calendar, Julian or Gregorian calendar date. It can be considered to be based on the conversion between Julian day an ...
*
ISO week date
The ISO week date system is effectively a leap week calendar system that is part of the ISO 8601 date and time standard issued by the International Organization for Standardization (ISO) since 1988 (last revised in 2019) and, before that, it was ...
References
{{DEFAULTSORT:Ordinal Date
Calendars
Ordinal numbers