B
Brian
Hi, I found this code on the web.. it was c# and I ran it through a c# to vb
converter( http://labs.developerfusion.co.uk/convert/csharp-to-vb.aspx
....but it is not correct.. what did it or I do incorrectly?
this is the c# code
public static void EasterSunday(int year, ref int month, ref int day)
{
int g = year % 19;
int c = year / 100;
int h = h = (c - (int)(c / 4) - (int)((8 * c + 13) / 25)
+ 19 * g + 15) % 30;
int i = h - (int)(h / 28) * (1 - (int)(h / 28) *
(int)(29 / (h + 1)) * (int)((21 - g) / 11));
day = i - ((year + (int)(year / 4) +
i + 2 - c + (int)(c / 4)) % 7) + 28;
month = 3;
if (day > 31)
{
month++;
day -= 31;
}
}this is the vb codePublic Shared Sub EasterSunday(ByVal year As Integer,
ByRef month As Integer, ByRef day As Integer)
Dim g As Integer = year Mod 19
Dim c As Integer = CInt(year / 100)
Dim h As Integer = CInt((c - c / 4 - (8 * c + 13) / 25 + 19 * g + 15) Mod
30)
Dim i As Integer = CInt(h - CInt(h / 28) * CInt(29 / (h + 1)) * CInt(21 - g)
/ 11)
day = i - ((year + CInt((year / 4)) + i + 2 - c + CInt((c / 4))) Mod 7) + 28
month = 3
If day > 31 Then
month += 1
day -= 31
End If
End Sub
converter( http://labs.developerfusion.co.uk/convert/csharp-to-vb.aspx
....but it is not correct.. what did it or I do incorrectly?
this is the c# code
public static void EasterSunday(int year, ref int month, ref int day)
{
int g = year % 19;
int c = year / 100;
int h = h = (c - (int)(c / 4) - (int)((8 * c + 13) / 25)
+ 19 * g + 15) % 30;
int i = h - (int)(h / 28) * (1 - (int)(h / 28) *
(int)(29 / (h + 1)) * (int)((21 - g) / 11));
day = i - ((year + (int)(year / 4) +
i + 2 - c + (int)(c / 4)) % 7) + 28;
month = 3;
if (day > 31)
{
month++;
day -= 31;
}
}this is the vb codePublic Shared Sub EasterSunday(ByVal year As Integer,
ByRef month As Integer, ByRef day As Integer)
Dim g As Integer = year Mod 19
Dim c As Integer = CInt(year / 100)
Dim h As Integer = CInt((c - c / 4 - (8 * c + 13) / 25 + 19 * g + 15) Mod
30)
Dim i As Integer = CInt(h - CInt(h / 28) * CInt(29 / (h + 1)) * CInt(21 - g)
/ 11)
day = i - ((year + CInt((year / 4)) + i + 2 - c + CInt((c / 4))) Mod 7) + 28
month = 3
If day > 31 Then
month += 1
day -= 31
End If
End Sub