![]() |
|
#3
|
|||
|
|||
|
I use formulas:
Code:
Easter Sunday: =ROUND((DAY(MINUTE(YearNo/38)/2+55)&".4."& YearNo)/7,)*7-6 Easter Friday: =ROUND((DAY(MINUTE(YearNo/38)/2+55)&".4."& YearNo)/7,)*7-6-2 First Pentecost: =ROUND((DAY(MINUTE(YearNo/38)/2+55)&".4."& YearNo)/7,)*7-6+49 etc. I ported this formula into SQL Server (as an UDF) too, but there another one is working somewhat better (i.e. it is slightly faster): Code:
USE [DBName]
GO
/****** Object: UserDefinedFunction [dbo].[udf_Easter] ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER FUNCTION [dbo].[udf_Easter] (@Year INT)
RETURNS DATETIME
AS
BEGIN
DECLARE @Date DATETIME
DECLARE @c INT
DECLARE @n INT
DECLARE @i INT
DECLARE @k INT
DECLARE @j INT
DECLARE @l INT
DECLARE @m INT
DECLARE @d INT
SET @n = @Year - 19 * (@Year / 19)
SET @c = @Year / 100
SET @k = (@c - 17) / 25
SET @i = @c - @c / 4 - (@c - @k) / 3 + 19 * @n + 15
SET @i = @i - 30 * (@i / 30)
SET @i = @i - (@i / 28) * (1 - (@i / 28) * (29 / (@i + 1)) * ((21 - @n)
/ 11))
SET @j = @Year + @Year / 4 + @i + 2 - @c + @c / 4
SET @j = @j - 7 * (@j / 7)
SET @l = @i - @j
SET @m = 3 + (@l + 40) / 44
SET @d = @l + 28 - 31 * (@m / 4)
SET @Date = CAST(@Year AS VARCHAR) + '-' + CAST(@m AS VARCHAR) + '-' +
CAST(@d AS VARCHAR)
RETURN @Date
END
|
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
Change template priority via VBA
|
heathkat | Word VBA | 2 | 05-28-2018 08:15 PM |
Adding national holiday to Master File
|
BarryB | Project | 3 | 04-19-2016 07:43 AM |
| Microsoft Project holiday integration | jeccles123 | Project | 4 | 03-22-2015 01:42 PM |
MS Project Holiday
|
pmjunkie | Project | 3 | 12-14-2011 09:08 AM |
| Calender month view peeve - display high priority over low priority appts? | ghumdinger | Outlook | 0 | 07-25-2011 03:56 AM |