(defun :DATE
>WEEKDAY
( year month day
/ century
-code month
-code tmp x
-nth year
-code
)
( (= tmp
17) (setq century
-code
4) ) ( (= tmp
18) (setq century
-code
2) ) ( (= tmp
19) (setq century
-code
0) ) ( (= tmp
20) (setq century
-code
6) ) ( (= tmp
21) (setq century
-code
4) ) )
(setq month
-code
(:DXF month '
( (1 .
0)(2 .
3)(3 .
3)(4 .
6)(5 .
1)(6 .
4)(7 .
6)(8 .
2)(9 .
5)(10 .
0)(11 .
3)(12 .
5) ) ) )
(setq year
-code
(rem (+ year
-code
(/ year
-code
4) ) 7) )
(setq x
-nth (rem (+ year
-code month
-code century
-code day
) 7) )
;|
LEAP YEAR CODE -
The other thing to take into account is whether you are dealing with a leap year
EDIT: If the date is in a January or February of a leap year,
you have to subtract one from your total before the final step
https://artofmemory.com/blog/how-to-calculate-the-day-of-the-week/
https://www.calculator.net/day-of-the-week-calculator.html?today=02%2F02%2F1940&x=86&y=19
|;
(nth x
-nth '
("Sunday" "Monday" "Tuesday" "Wednesday" "Thursday" "Friday" "Saturday") ) )
(defun C:K
() (:DATE
>WEEKDAY
2022 1 3 ) )