Database Welcome to the Teradata Forums. Read the guidelines on posting. Email notifications and RSS feeds are available, and also a chronological list of all forum activity.
 Print All Forums Database DavidK 3 posts Joined 07/15 16 Jul 2015 Easter monday calculation Hello,   does anybody know how to simply calculate Easter monday in TD SQL.   THX dnoeth 4628 posts Joined 11/04 16 Jul 2015 There's no simple calculation for easter monday :-) I did that some years ago: ```/*** Calculation of easter sunday, implemented using an algorithm from http://www.merlyn.demon.co.uk/estralgs.txt Based on easter sunday the moveable christian feasts can be calculated, e.g.: Ascension Day - 39 days after easter sunday Pentecost - 49 days after easter sunday Corpus Christi - 60 days after easter sunday SELECT 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 DATE SPECIFIC easter_sunday_I RETURNS NULL ON NULL INPUT CONTAINS SQL DETERMINISTIC COLLATION INVOKER INLINE TYPE 1 RETURN ((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 DATE SPECIFIC easter_sunday_DT RETURNS NULL ON NULL INPUT CONTAINS SQL DETERMINISTIC COLLATION INVOKER INLINE TYPE 1 RETURN easter_sunday(EXTRACT(YEAR FROM cdate)) ; REPLACE FUNCTION easter_sunday(cdate TIMESTAMP) RETURNS DATE SPECIFIC easter_sunday_TS RETURNS NULL ON NULL INPUT CONTAINS SQL DETERMINISTIC COLLATION INVOKER INLINE TYPE 1 RETURN easter_sunday(EXTRACT(YEAR FROM cdate)) ; ```  Dieter DavidK 3 posts Joined 07/15 16 Jul 2015 You are great Dieter.   Thank you very much You must sign in to leave a comment. Active Posters