Determining the Dates of Easter for Any Year in Oracle PLSQL
You would like to dynamically determine the dates of Easter for a given year.
Oracle doesn’t provide a single, elegant function to perform Easter calculations for you. But Oracle does
have robust date arithmetic functions that we can use to build our own Easter calculator. This begs the
question, how do we decide the dates of Easter anyway?
For Easter under the Gregorian calendar, Easter Sunday is the Sunday following the first full moon
after Lent. Contemporary algorithms translate this to the first Sunday after the first full moon on or after
The next function returns the date of Easter Sunday for a specified year.
create or replace function easter_sunday(given_year number) return date
golden_metonic := mod(given_year,19) + 1;
century := (given_year / 100) + 1;
leap_year_fix := (3 * century / 4) – 12;
lunar_sync := ((8 * century + 5)/25) – 5;
sunday_date := (5 * given_year / 4) – leap_year_fix – 3;
epact := mod((11 * golden_metonic + 20 + lunar_sync – leap_year_fix),30);
if((epact = 25 and golden_metonic < 11) or (epact = 24)) then
epact := epact + 1;
day_of_month := 44 – epact;
if(day_of_month < 21) then
day_of_month := day_of_month + 30;
easter_offset := (day_of_month + 7 – mod((sunday_date + day_of_month),7)) – 1;
return to_date(’01-MAR-‘ || to_char(given_year),’DD-MON-YYYY’) + easter_offset;
We could have coded this in pure SQL as one rather large nested set of IF and CASE statements, but
this function is both easier to read and easier to use in practice. We can now find Easter for any given
year, such as 2000 shown in the next SQL statement.
We can also dynamically determine Easter Sunday for the current year without needing to explicitly
state the year. The next SQL statement illustrates this in action.
select easter_sunday(extract(year from (sysdate)))