Full Version: Help with Date
eacollie
I'm calling a function that returns a date: (GetEasterDate(year as int)

The return date: dtEasterDate = DateSerial(y, m, d) for 2010 displays (in watch list) as 4/4/2010 (which is correct).

In my call to this function, I have:
dtEaster = GetEasterDate(Year(dtTestDate))
where dtEaster is set as a date variable.

dtEaster is not picking up the date (displays at 12:00 in watch list)

What am I doing wrong?

Thanks!!!
Doug Steele
What's the actual code of your GetEasterDate function?
eacollie
CODE
Dim FirstDig, Remain19, temp    'intermediate results
Dim tA, tB, tC, tD, tE          'table A to E results
Dim d As Integer
Dim m As Integer
Dim dtEasterDate As Date

FirstDig = y \ 100              'first 2 digits of year
Remain19 = y Mod 19             'remainder of year / 19

' calculate PFM date
temp = (FirstDig - 15) \ 2 + 202 - 11 * Remain19

Select Case FirstDig
Case 21, 24, 25, 27 To 32, 34, 35, 38
temp = temp - 1
Case 33, 36, 37, 39, 40
temp = temp - 2
End Select
temp = temp Mod 30

tA = temp + 21
If temp = 29 Then tA = tA - 1
If (temp = 28 And Remain19 > 10) Then tA = tA - 1

'find the next Sunday
tB = (tA - 19) Mod 7

tC = (40 - FirstDig) Mod 4
If tC = 3 Then tC = tC + 1
If tC > 1 Then tC = tC + 1

temp = y Mod 100
tD = (temp + temp \ 4) Mod 7

tE = ((20 - tB - tC - tD) Mod 7) + 1
d = tA + tE

'return the date
If d > 31 Then
d = d - 31
m = 4
Else
m = 3
End If
dtEasterDate = DateSerial(y, m, d)

End Function
eacollie
Got it! thanks
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.