Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Leap years
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Divers
Thread ID:
00115008
Message ID:
00115225
Vues:
24
>Great Code!! :D==============
>
>Hard to study the calculation on Easter!!
>In bible, I just Know Julian Year has only 360 days.
>But how to count the Easter.... Donno!
>Another worth is handling BC and AD problem... !_!'
>
>Although I got a simply formula to find the weekday of Today,
>I still claim worth on this code!!
>
Justok,

And here's a FoxPro class to calculate the date of Easter.
DEFINE CLASS Easter_Day AS CUSTOM

FUNCTION DateEaster

  LPARAMETER pnyearno
  * The year during which Easter
  * is to be calculate for as a numeric value

  LOCAL ldresult, lngold, lcyear, lcpaschalmoon, lndayofwk, lnamounttoadd
  lngold = This.Golden_No(pnyearno)
  lcyear = TRANSFORM(pnyearno, "####")
  lcpaschalmoon = This.FullMoonDate(lngold)
  lcpaschalmoon = LEFT(lcpaschalmoon, 5) + "-" + lcyear
  lndayofwk = DOW(CTOD(lcpaschalmoon), 1)
  lnamounttoadd = (7 - lndayofwk) + 1
  ldresult = CTOD(lcpaschalmoon) + lnamounttoadd
  RETURN ldresult
ENDFUNC

FUNCTION Golden_No

  LPARAMETER pnyear

  LOCAL lnresult
  lnresult = pnyear + 1
  lnresult = lnresult % 19
  IF lnresult = 0
    lnresult = 19
  ENDIF
  RETURN lnresult
ENDFUNC

FUNCTION FullMoonDate

  LPARAMETER pngoldnum
  
  LOCAL lcresult
  DO CASE
    CASE pngoldnum = 1
      lcresult = "04-14A"
    CASE pngoldnum = 2
      lcresult = "04-03B"
    CASE pngoldnum = 3
      lcresult = "03-23E"
    CASE pngoldnum = 4
      lcresult = "04-11C"
    CASE pngoldnum = 5
      lcresult = "03-31F"
    CASE pngoldnum = 6
      lcresult = "04-18C"
    CASE pngoldnum = 7
      lcresult = "04-08G"
    CASE pngoldnum = 8
      lcresult = "03-28C"
    CASE pngoldnum = 9
      lcresult = "04-16A"
    CASE pngoldnum = 10
      lcresult = "04-05D"
    CASE pngoldnum = 11
      lcresult = "03-25G"
    CASE pngoldnum = 12
      lcresult = "04-13E"
    CASE pngoldnum = 13
      lcresult = "04-02A"
    CASE pngoldnum = 14
      lcresult = "03-22D"
    CASE pngoldnum = 15
      lcresult = "04-10B"
    CASE pngoldnum = 16
      lcresult = "03-30E"
    CASE pngoldnum = 17
      lcresult = "04-17B"
    CASE pngoldnum = 18
      lcresult = "04-07F"
    CASE pngoldnum = 19
      lcresult = "03-27B"
  ENDCASE
  RETURN lcresult
ENDFUNC
ENDDEFINE
I originally wrote this some years ago (in QuickBASIC, I think) and can't remember the meaning of the trailing character in the FullMoonDate function.
George

Ubi caritas et amor, deus ibi est
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform