Function: calendar-julian-from-absolute
calendar-julian-from-absolute is an autoloaded and byte-compiled
function defined in cal-julian.el.gz.
Signature
(calendar-julian-from-absolute DATE)
Documentation
Compute the Julian (month day year) corresponding to the absolute DATE.
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-julian.el.gz
;;;###cal-autoload
(defun calendar-julian-from-absolute (date)
"Compute the Julian (month day year) corresponding to the absolute DATE.
The absolute date is the number of days elapsed since the (imaginary)
Gregorian date Sunday, December 31, 1 BC."
(let* ((approx (/ (+ date 2) 366)) ; approximation from below
(year ; search forward from the approximation
(+ approx
(calendar-sum y approx
(>= date (calendar-julian-to-absolute
(list 1 1 (1+ y))))
1)))
(month ; search forward from January
(1+ (calendar-sum m 1
(> date
(calendar-julian-to-absolute
(list m
(if (and (= m 2) (zerop (% year 4)))
29
(aref [31 28 31 30 31 30 31
31 30 31 30 31]
(1- m)))
year)))
1)))
(day ; calculate the day by subtraction
(- date (1- (calendar-julian-to-absolute (list month 1 year))))))
(list month day year)))