×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: Text
Posted by: Pavel San
Added: Feb 19, 2015 9:50 AM
Modified: Feb 19, 2015 10:32 AM
Views: 19
Function for LibreOffice to calculate Easter Day (Catolic) in cell.
Source: https://en.wikipedia.org/wiki/Computus#Gauss_algorithm
  1. REM  *****  BASIC  *****
  2. REM Алгоритм Гаусса вычисления даты Пасхи (католич.)
  3. REM Источник: Википедия
  4. REM ************************************************
  5. Function EasterDayCatolic(Year)
  6. a = Year Mod 19
  7. b = Year Mod 4
  8. c = Year Mod 7
  9. k = int (Year/100)
  10. p = int ((13 + 8 * k)/25)
  11. q = int (k/4)
  12. M = (15 - p + k -q) mod 30
  13. N = (4 + k - q) mod 7
  14. d = (19 * a + M) mod 30
  15. e = (2 * b + 4 * c + 6 * d + N) mod 7
  16. If (d + e) <= 9 Then
  17. Mo = 3 ' март
  18. Da = 22 + d + e
  19. Else
  20. Mo = 4 ' апрель
  21. Da = d + e - 9
  22. End If
  23. EasterDayCatolic = DateSerial(Year, Mo, Da)
  24. End Function