Create Function dbo.Year2Easter ( @Year int ) RETURNS varchar(45) As Begin /* Source of algorithm : Nature, 1876 April 20, vol. 13, p. 487 Converted to T-SQL : Robert Davis, February 6, 2005 */ /* Integer variables for mathematical computations */ Declare @a int, @b int, @c int, @d int, @e int, @f int, @g int, @h int, @i int, @k int, @l int, @m int, @p int /* Integer variables for mathematical results */ Declare @EasterMonth int, @EasterDay int Declare @Easter varchar(45) If @Year < 1582 -- oldest year for which algorithm works Begin Set @Easter = ''Year2Easter() expects a 4 digit year => 1582.'' End Else Begin Set @a = @Year % 19 Set @b = @Year / 100 Set @c = @Year % 100 Set @d = @b / 4 Set @e = @b % 4 Set @f = (@b + 8) / 25 Set @g = (@b - @f + 1) / 3 Set @h = (19 * @a + @b - @d - @g + 15) % 30 Set @i = @c / 4 Set @k = @c % 4 Set @l = (32 + 2 * @e + 2 * @i - @h - @k) % 7 Set @m = (@a + 11 * @h + 22 * @l) / 451 Set @EasterMonth = (@h + @l - 7 * @m + 114) / 31 -- [3 = March, 4 = April] Set @p = (@h + @l - 7 * @m + 114) % 31 Set @EasterDay = @p + 1 -- Day of the month Select @Easter = Case @EasterMonth When 3 Then ''March'' Else ''April'' End Select @Easter = @Easter + space(1) + Cast(@EasterDay as varchar) + '', '' + Cast(@Year as varchar) End RETURN @Easter End