Database
Fan

## Easter monday calculation

Hello,

does anybody know how to simply calculate Easter monday in TD SQL.

THX

Tags (1)
2 REPLIES
Junior Contributor

## Re: Easter monday calculation

There's no simple calculation for easter monday :-)

I did that some years ago:

`/***Calculation of easter sunday, implemented using an algorithm fromhttp://www.merlyn.demon.co.uk/estralgs.txtBased on easter sunday the moveable christian feasts can be calculated, e.g.:Ascension Day  - 39 days after easter sundayPentecost      - 49 days after easter sundayCorpus Christi - 60 days after easter sundaySELECT easter_sunday(2013); *** Query completed. One row found. One column returned. *** Total elapsed time was 1 second.easter_sunday(2013)-------------------         2013-03-31***/REPLACE FUNCTION easter_sunday(yr INTEGER)RETURNS DATESPECIFIC easter_sunday_IRETURNS NULL ON NULL INPUTCONTAINS SQLDETERMINISTICCOLLATION INVOKERINLINE TYPE 1RETURN   ((yr-1900)*10000 + 0301 (DATE)) +  ((((170-((YR MOD 19*3510+((((YR/100)*733+363)/25) + (YR/400))*319)/330) MOD 29+(YR+(YR/4)-(YR/100)+(YR/400))*57)/7)*7 MOD 57)-1);REPLACE FUNCTION easter_sunday(cdate DATE)RETURNS DATESPECIFIC easter_sunday_DTRETURNS NULL ON NULL INPUTCONTAINS SQLDETERMINISTICCOLLATION INVOKERINLINE TYPE 1RETURN easter_sunday(EXTRACT(YEAR FROM cdate));REPLACE FUNCTION easter_sunday(cdate TIMESTAMP)RETURNS DATESPECIFIC easter_sunday_TSRETURNS NULL ON NULL INPUTCONTAINS SQLDETERMINISTICCOLLATION INVOKERINLINE TYPE 1RETURN easter_sunday(EXTRACT(YEAR FROM cdate));`
Fan

## Re: Easter monday calculation

You are great Dieter.

Thank you very much