CREATE FUNCTION [dbo].[Get_EasterSunday](@iYear as Int) RETURNS SmallDateTime AS ------------------------------------------------------------------------------ -- Get_EasterSunday -- ------------------------------------------------------------------------------ BEGIN DECLARE @ePactCalc Int DECLARE @PaschalDaysCalc Int DECLARE @NumofDaysToSunday Int DECLARE @EasterMonth Int DECLARE @EasterDay Int SET @ePactCalc = (24 + 19 * (@iYear %19)) % 30 SET @PaschalDaysCalc = @ePactCalc - (@ePactCalc/28) SET @NumOfDaysToSunday = @PaschalDaysCalc - ((@iYear + @iYear/4 + @PaschalDaysCalc - 13) % 7) SET @EasterMonth = 3 + (@NumOfDaysToSunday + 40)/44 SET @EasterDay = @NumOfDaysToSunday + 28 - (31*(@EasterMonth/4)) RETURN(SELECT CONVERT(SmallDateTime, RTRIM(@iYear) + Right('0' + RTRIM(@EasterMonth), 2) + Right('0' + RTRIM(@EasterDay), 2))) END