Options

Calculate Easter

Phoenix185Phoenix185 Member Posts: 4
I want to calculate Easter but I don't have any idea how one could make it!

has anyone allready done it?

Comments

  • Options
    Luc_VanDyckLuc_VanDyck Member, Moderator, Administrator Posts: 3,633
    Because it's almost Christmas, I give you the code to calculate Easter O:)
    fctCalculateEasterDate(pintYear : Integer) : Date
    
    x := pintYear;
    a := x MOD 19;
    b := x DIV 100;
    c := x MOD 100;
    d := b DIV 4;
    e := b MOD 4;
    f := (b + 8) DIV 25;
    g := (b - f + 1) DIV 3;
    h := (19 * a + b - d - g + 15) MOD 30;
    i := c DIV 4;
    k := c MOD 4;
    l := (32 + 2 * e + 2 * i - h - k) MOD 7;
    m := (a + 11 * h + 22 * l) DIV 451;
    
    n := (h + l - 7 * m + 114) DIV 31;
    p := (h + l - 7 * m + 114) MOD 31;
    
    EXIT(DMY2DATE(p + 1,n,pintYear));
    

    All vars (x, a, b, etc. are of type Integer).
    No support using PM or e-mail - Please use this forum. BC TechDays 2024: 13 & 14 June 2024, Antwerp (Belgium)
  • Options
    RobertMoRobertMo Member Posts: 484
    I have always questioned myself, how people know when it's Easter? The answer is obvious...
               ®obi           
    ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
  • Options
    Luc_VanDyckLuc_VanDyck Member, Moderator, Administrator Posts: 3,633
    Indeed ... now you can throw away your pocket agenda ;-)
    No support using PM or e-mail - Please use this forum. BC TechDays 2024: 13 & 14 June 2024, Antwerp (Belgium)
  • Options
    DenSterDenSter Member Posts: 8,304
    Are you sure it's not April 1st? :-k
  • Options
    Phoenix185Phoenix185 Member Posts: 4
    it works! :D

    thx

    merry x-mas
Sign In or Register to comment.