Function: calendar-iso-from-absolute
calendar-iso-from-absolute is an autoloaded and byte-compiled function
defined in cal-iso.el.gz.
Signature
(calendar-iso-from-absolute DATE)
Documentation
Compute the "ISO commercial date" corresponding to the absolute DATE.
The ISO year corresponds approximately to the Gregorian year, but weeks start on Monday and end on Sunday. The first week of the ISO year is the first such week in which at least 4 days are in a year. The ISO commercial date has the form (week day year) in which week is in the range 1..52 and day is in the range 0..6 (1 = Monday, 2 = Tuesday, ..., 0 = Sunday). The absolute date is the number of days elapsed since the (imaginary) Gregorian date Sunday, December 31, 1 BC.
Source Code
;; Defined in /usr/src/emacs/lisp/calendar/cal-iso.el.gz
;;;###cal-autoload
(defun calendar-iso-from-absolute (date)
"Compute the \"ISO commercial date\" corresponding to the absolute DATE.
The ISO year corresponds approximately to the Gregorian year, but weeks
start on Monday and end on Sunday. The first week of the ISO year is the
first such week in which at least 4 days are in a year. The ISO commercial
date has the form (week day year) in which week is in the range 1..52 and
day is in the range 0..6 (1 = Monday, 2 = Tuesday, ..., 0 = Sunday). The
absolute date is the number of days elapsed since the (imaginary) Gregorian
date Sunday, December 31, 1 BC."
(let* ((approx (calendar-extract-year
(calendar-gregorian-from-absolute (- date 3))))
(year (+ approx
(calendar-sum y approx
(>= date (calendar-iso-to-absolute
(list 1 1 (1+ y))))
1))))
(list
(1+ (/ (- date (calendar-iso-to-absolute (list 1 1 year))) 7))
(% date 7)
year)))