Ver Mensaje Individual
  #5 (permalink)  
Antiguo 03/12/2004, 03:24
sqa212
 
Fecha de Ingreso: mayo-2003
Mensajes: 866
Antigüedad: 21 años, 11 meses
Puntos: 0
He encontrado esto, pero esta en ASp.Net (ni idea de net ),
no se si los resultados que arroja la funcion son correctos).
Alguien sabria pasar esto a asp no Net???
<%Public Const Synod = 29.53058867

Public Const BaseNewMoonDateString As String = "18/11/1998 9:36:00 pm"
'Test a date for moon phase:
'Returns:
' 0: None
' 1: new moon
' 2: Quarter moon
' 3: Full moon
' 4: Three-quarter moon

Public Function MoonPhase(dDate As Date) As Integer

Select Case MoonAge(dDate)

'Day of a new moon
Case Is > Synod - 1:
MoonPhase = 1

'Day of a 1/4 moon
Case Synod / 4 - 1 To Synod / 4:
MoonPhase = 2

'Day of a full moon
Case Synod / 2 - 1 To Synod / 2:
MoonPhase = 3

'Day of a 3/4 moon
Case 3 * Synod / 4 - 1 To 3 * Synod / 4:
MoonPhase = 4

'No special day
Case Else:
MoonPhase = 0

End Select
End Function

Public Function MoonAge(dDate As Date) As Single
Dim BaseDate As Date
BaseDate = CDate(BaseNewMoonDateString)

MoonAge = Remainder((dDate - BaseDate), Synod)

End Function
Public Function Remainder(Number As Variant, DivideBy As _
Variant) As Variant
If Number = 0 Then
Remainder = 0
Else
Remainder = Number - DivideBy * Int(Number / DivideBy)
End If

End Function
%>