Go Back   Access World Forums > Microsoft Access Reference > Code Repository

 
Reply
 
Thread Tools Rate Thread Display Modes
Old 07-07-2017, 01:41 PM   #1
ridders
AWF VIP
Gold Supporter
 
ridders's Avatar
 
Join Date: Jan 2017
Location: Somerset, UK
Posts: 3,397
Thanks: 60
Thanked 782 Times in 725 Posts
ridders has a spectacular aura about ridders has a spectacular aura about ridders has a spectacular aura about
How to calculate Easter for any year

I mentioned this in another thread earlier today.
https://www.access-programmers.co.uk...d.php?t=294618

The function below calculates Easter Sunday for any year.
Apparently, that is the first Sunday after the first ecclesiastical full moon that occurs on or after March 21.
And there was me thinking they just made it up every year ....

Code:
Public Function GetEasterSunday(Yr As Integer) As Date

'Code taken from http://www.cpearson.com/excel/Easter.aspx

    Dim D As Integer
    D = (((255 - 11 * (Yr Mod 19)) - 21) Mod 30) + 21
    GetEasterSunday = DateSerial(Yr, 3, 1) + D + (D > 48) + 6 - ((Yr + Yr \ 4 + D + (D > 48) + 1) Mod 7)
            
End Function
That's it!

The code is by Chip Pearson who is, in my view anyway, the Excel equivalent of Allen Browne.
I just made minor tweaks to use it in Access

Apparently its 'only' guaranteed to be correct between 1900 and 2368 - I've no idea why.
After that it doesn't always work
However, if you're planning to still be around in 2369, you've got plenty of time to modify the code .. and to post a new version here

If you've never checked Chip's site, I strongly recommend it.
He also has code to calculate other holiday dates (mainly USA such as Thanksgiving)
Lots of other 'goodies' such as 'Programming The VBA Editor' using the 'Microsoft Visual Basic For Applications Extensibility 5.3' reference library

http://www.cpearson.com/Excel/MainPage.aspx

__________________
Colin
Mendip Data Systems
Access 2010 32-bit, Access 2016 32-bit & 64-bit, SQL Server Express 2014, Windows 10,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
, Tapatalk


If this answer has helped, please:
Click the Thanks button and/or click the 'reputation' scales symbol on the left, tick 'I approve' and leave a comment. Cheers!

Last edited by ridders; 07-07-2017 at 01:57 PM.
ridders is offline   Reply With Quote
Old 01-11-2018, 02:42 AM   #2
ridders
AWF VIP
Gold Supporter
 
ridders's Avatar
 
Join Date: Jan 2017
Location: Somerset, UK
Posts: 3,397
Thanks: 60
Thanked 782 Times in 725 Posts
ridders has a spectacular aura about ridders has a spectacular aura about ridders has a spectacular aura about
More Holiday Dates

The attached database Holidays021 calculates a variety of holiday dates for various different calendars and religions

Word doc included with further explanations

The attached database isn't mine and I don't have the author details.
I know its several years old but that makes it no less useful.

Please let me know if it is yours or you know who wrote it.
Attached Files
File Type: zip Holidays021.zip (169.6 KB, 19 views)
__________________
Colin
Mendip Data Systems
Access 2010 32-bit, Access 2016 32-bit & 64-bit, SQL Server Express 2014, Windows 10,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
, Tapatalk


If this answer has helped, please:
Click the Thanks button and/or click the 'reputation' scales symbol on the left, tick 'I approve' and leave a comment. Cheers!
ridders is offline   Reply With Quote
Reply

Tags
chip pearson , easter calculation , vba extensibility

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to calculate % change of invoice amounts year over year ajblue Queries 2 10-08-2012 06:54 AM
calculate balance and total expense for each year? Tini Queries 2 04-26-2011 04:19 PM
calculate specific date last year anthonys Queries 1 08-05-2010 07:49 AM
Insert new columns and calculate the percentage for Year over Year Zandra Queries 3 08-14-2009 06:02 AM
Calculate number of entries by year and frequency SnowPatrol Queries 3 05-02-2006 06:44 AM




All times are GMT -8. The time now is 02:16 PM.


Microsoft Access Help
General
Tables
Queries
Forms
Reports
Macros
Modules & VBA
Theory & Practice
Access FAQs
Code Repository
Sample Databases
Video Tutorials

Sponsored Links

How to advertise

Media Kit


Powered by vBulletin®
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
(c) copyright 2017 Access World