Announcement

Collapse
No announcement yet.

How to calculate this in AMS

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Friethoe
    replied
    Hi,

    I found it and if you need it too some day, here it is:


    function Easter(year)
    local leap_year
    if year % 4 == 0 then
    if year % 100 == 0 then
    if year % 400 == 0 then
    leap_year = true
    else
    leap_year = false
    end
    else
    leap_year = true
    end
    else
    leap_year = false
    end
    local a = year % 19
    local b = math.floor(year / 100)
    local c = year % 100
    local d = math.floor(b / 4)
    local e = b % 4
    local f = math.floor((b + 8) / 25)
    local g = math.floor((b - f + 1) / 3)
    local h = (19 * a + b - d - g + 15) % 30
    local i = math.floor(c / 4)
    local k = c % 4
    local L = (32 + 2 * e + 2 * i - h - k) %7
    local m = math.floor((a + 11 * h + 22 * L) / 451)
    local month = math.floor((h + L - 7 * m + 114) / 31)
    local day = (h + L - 7 * m + 114) % 31 + 1
    if month == 2 then --adjust dates in February
    day = leap_year and day - 2 or day - 3
    end
    return day, month
    end

    Leave a comment:


  • Friethoe
    started a topic How to calculate this in AMS

    How to calculate this in AMS

    Hi,

    In Excel I have a formula to calculate Easter and I need this formula to do in a AMS project, but I can't figure out how to do this.

    In Excel the formula would be like this:
    Cell A1=1-4-2015
    Cell A2=FIXED((A1)/7+MOD(MOD(YEAR(A1);19)*19-7;30)*14%;0)*7-6

    That works like a charm, but to port it to AMS , can you help me?!

    Thanks,
    Eric
Working...
X