Function: math-date-to-iso-dt
math-date-to-iso-dt is a byte-compiled function defined in
calc-forms.el.gz.
Signature
(math-date-to-iso-dt DATE)
Documentation
Return the ISO8601 date (year week day) of DATE.
Source Code
;; Defined in /usr/src/emacs/lisp/calc/calc-forms.el.gz
(defun math-date-to-iso-dt (date)
"Return the ISO8601 date (year week day) of DATE."
(unless (Math-integerp date)
(setq date (math-floor date)))
(let* ((approx (nth 0 (math-date-to-gregorian-dt (math-sub date 3))))
(year (math-add approx
(let ((y approx)
(sum 0))
(while (>= (math-compare date
(math-absolute-from-iso-dt (setq y (math-add y 1)) 1 1)) 0)
(setq sum (+ sum 1)))
sum))))
(list
year
(math-add (car (math-idivmod
(math-sub date (math-absolute-from-iso-dt year 1 1))
7))
1)
(let ((day (calcFunc-mod date 7)))
(if (= day 0) 7 day)))))