## 5.1 Rata Die Algorithms

The Rata Die is a count of the number of days since a base date of December 31 of the year zero in the proleptic Gregorian calendar. Thus Rata Die day one occurs on January 1 of the year 1 which begins at Julian Day Number 1721425.5. The algorithm for calculating the Rata Die given a year, month, and day in the Gregorian Calendar is the same as calculating the Julian Day Number except that in the final step, the number of days since March 1 of the year 0 is converted to the number of days since December 31 of the year zero rather than the number of days since November 24.5 in the year -4713. Since there are 306 days between March 1 and December 31, the conversion consists of subtracting 306 from the day count relative to March 1 of the year 0. That is, March 1 of the year zero is Rata Die day -306.
The following is a general procedure for calculating the Rata Die:

STEP 1 Calculate the value of Z using **ONE** of the following methods:

- Z = Y + (M-14)\12

- IF M<3 THEN Z=Y-1 ELSE Z=Y

- On some computers, we can place the month and year in memory locations so that a subtraction of the month will carry into the year when the month is January or February.

STEP 2 Calculate the value of F using **ONE** of the following methods:

- F is the value of a vector indexed by M. This vector has values 306, 337, 0, 31, 61, 92, 122, 153, 184, 214, 245, 275. This method is usually the fastest method and often takes less computer memory to implement.

- IF M<3 THEN M=M+12

F = (153*M-457)\5

- IF M<3 THEN M=M+12

F = (979*M-2918)\32

This allows a shift to carry out the division.

- F = (979*(M-12*((M-14)\12))-2918)\32

This eliminates the need for an IF test and carries out the division using a shift.

STEP 3 The Rata Die is

D+F+365*Z+Z\4-Z\100+Z\400 - 306

Therefore, a typical algorithm will comprise:

IF m < 3 THEN

m = m + 12

y = y - 1

END IF

rd = d + (153 * m - 457) \ 5 + 365 * y + y \ 4 - y \ 100 + y \ 400 - 306

where

d= day of the month

m = month

y = year

(in the Gregorian calendar) and

rd is the Rata Die.

AESIR RESEARCH HOME PAGE

Last Modified: April 7, 2005