File tree 2 files changed +31
-0
lines changed
2 files changed +31
-0
lines changed Original file line number Diff line number Diff line change
1
+ IMPORT Std;
2
+
3
+ /**
4
+ * Function returns a date in Std.Date.Date_t format
5
+ * representing the date Easter falls on for the
6
+ * given year.
7
+ *
8
+ * @param year Four-digit year; REQUIRED
9
+ *
10
+ * @return The date Easter falls on in the given
11
+ * year, in Std.Date.Date_t format.
12
+ */
13
+ EXPORT EasterForYear(INTEGER2 year) := FUNCTION
14
+ c := year DIV 100 ;
15
+ g := year % 19 ;
16
+ h := ((c - (c DIV 4 ) - ((8 * c + 13 ) DIV 25 ) + (19 * g) + 15 ) % 30 );
17
+ i := (h - (h DIV 28 ) * (1 - (29 DIV (h + 1 )) * ((21 - g) DIV 11 )));
18
+ j := ((year + (year DIV 4 ) + i + 2 - c + (c DIV 4 )) % 7 );
19
+ l := i - j;
20
+ month := (3 + ((l + 40 ) DIV 44 ));
21
+ day := (l + 28 - 31 * (month DIV 4 ));
22
+
23
+ RETURN Std.Date .DateFromParts(year, month, day);
24
+ END ;
25
+
26
+ /*
27
+ OUTPUT(EasterForYear(2022), NAMED('easter_2022')); // 20220417
28
+ OUTPUT(EasterForYear(2023), NAMED('easter_2023')); // 20230409
29
+ OUTPUT(EasterForYear(2024), NAMED('easter_2024')); // 20240331
30
+ */
Original file line number Diff line number Diff line change @@ -30,6 +30,7 @@ own ECL bundle. Please see
30
30
* [ BWR_ShowPlatformConstants.ecl] ( BWR/BWR_ShowPlatformConstants.ecl )
31
31
* [ ConcatFieldValues.ecl] ( ConcatFieldValues.ecl )
32
32
* [ DatasetSkew.ecl] ( DatasetSkew.ecl )
33
+ * [ EasterForYear.ecl] ( EasterForYear.ecl )
33
34
* [ ExportZipArchive.ecl] ( ExportZipArchive.ecl )
34
35
* [ Factorial.ecl] ( Factorial.ecl )
35
36
* [ FuzzyStringSearch.ecl] ( FuzzyStringSearch.ecl )
You can’t perform that action at this time.
0 commit comments