Sub MoonPhase As String
Dim c,e, b As Int
Dim jd As Double
Year = DateTime.GetYear(DateTime.Now)
Month = DateTime.GetMonth(DateTime.Now)
Day = DateTime.GetDayOfMonth(DateTime.Now)
If (Month < 3) Then
Year = Year - 1
Month = Month + 12
End If
Month = Month + 1
c = 365.25 * Year
e = 30.6 * Month
jd = c + e + Day - 694039.09
jd = jd / 29.53
b = jd
jd = jd - b
b = jd * 8 + 0.5
b = Bit.AND(b, 7)
Select b
Case 0
Return "New"
Case 1
Return "Waxing Crescent"
Case 2
Return "First Quarter"
Case 3
Return "Waxing Gibbous"
Case 4
Return "Full"
Case 5
Return "Waning Gibbous"
Case 6
Return "Last Quarter"
Case 7
Return "Waning Crescent"
End Select
end sub