WelcomeServicesPortfolioKnowledge BaseContact Us
27 Seconds, Inc.


Knowledge base View Article

need hosting?

Need hosting? We use and love our host - CrystalTech.com!
Need hosting? We use and love our host - CrystalTech.com!

Text Disguise - CAPTCHA-image/Human Interactive Proof web services

National Holiday Dates and Bank Holiday Dates - web site that provides the dates of national and bank holidays for the United States, United Kingdom, Ireland and Scotland

Holiday Web Service - web services for programmers to provide the dates of national and bank holidays in their applications for the United States, United Kingdom, Ireland and Scotland

Our Family Heart - web site to help families communicate no matter where they are

What?! You haven't heard about the greatest remote controlled flyer to come out in years?! Checkout the FlyTech DragonFly now!

When is Easter?

Summary: I have started working on a calendar and I have decided to figure out calculations to determine various US-based national holidays.
 
Keywords: ASP
DATE
EASTER
GREGORIAN
VBS
VBSCRIPT
Applicable Software: Active Server Pages (ASP)
 
Body:

I have started working on a calendar and I have decided to figure out calculations to determine various US-based national holidays. Most are simple rules (3rd Monday of XYZ month. Easter isn't. It's based on all kinds of things. (Obviously, none of it made sense to me.)

Fortunately, Google came to the rescue. Through a variety of links, I finally happened across the US Naval Observatory's page, "The Date of Easter" (http://aa.usno.navy.mil/faq/docs/easter.html).

Because that would have been entirely too difficult for my feeble little mind, here's what I copied and created as a VBScript function:

Function GetEasterDate(ByVal y)
'''''''''''''''''''''''''''''''''''''''''''''''''''''
'Credit for function's code to:						'
'	http://aa.usno.navy.mil/faq/docs/easter.html	'
'''''''''''''''''''''''''''''''''''''''''''''''''''''
Dim c, n, k, i, j, l, m, d

    c = y \ 100
    n = y - 19 * ( y \ 19 )
    k = ( c - 17 ) \ 25
    i = c - c \ 4 - ( c - k ) \ 3 + 19 * n + 15
    i = i - 30 * ( i \ 30 )
    i = i - ( i \ 28 ) * ( 1 - ( i \ 28 ) * ( 29 \ ( i + 1 ) ) * ( ( 21 - n ) \ 11 ) )
    j = y + y \ 4 + i + 2 - c + c \ 4
    j = j - 7 * ( j \ 7 )
    l = i - j
    m = 3 + ( l + 40 ) \ 44
    d = l + 28 - 31 * ( m \ 4 )

	GetEasterDate = DateSerial(y, m, d)

End Function

To use it, you would do:

Msgbox GetEasterDate(2003)

Note, I've published a public set of web services for calculating holiday dates for the United States, United Kingdom, Northern Ireland and Scotland. For more information see, HolidayWebService.com.

 
Author: Douglas L. Setzer, II, http://www.27seconds.com
Posted On: 5/23/2003 8:27:50 AM

Rate this article: Average: 10
n/a12345678910
Comments?

Article Search   |   All Articles

 

 
©2002 27 Seconds, Inc. All Rights Reserved.