Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles
(untagged)

Computing Easter Date - VB Function

0.00/5 (No votes)
12 Mar 2013 1  
VB Function to Comput Easter Date

Introduction

Wen i start to work with the calendar control i felt the necessity to obtain the Ester Date to compute the other two moving Holy-Days, The Ash Wednesday -47 Days and corpus christy + 60 Days in order to mark that days in the calendar as holy-Days.

So i surf the net to study the problem and i found these URLs:

In VB:

Function F_easter_date(Year_of_easter as integer)
   Dim y as integer = Year_of_easter
   Dim  d  As Integer =  (((255 - 11 * (y Mod 19)) - 21) Mod 30) + 21
   Dim easter_date = New DateTime(y, 3, 1)
easter_date = easter_date.AddDays(+ d + (d > 48) + 6 - ((y + y \ 4 + d + (d > 48) + 1) Mod 7))
      return(easter_date)
     End function

Then:

Sub ex()
Dim Date_AshWednesday as DateTime = F_easter_date("str_Year").AddDays(-47)
Dim Date_CorpusChristy as DateTime = F_easter_date("str_Year").AddDays(60)
End Sub

In Excel:

 =FLOOR(DAY(MINUTE(A1/38)/2+56)&"/5/"&A1;7)-34

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here