Function: math-absolute-from-gregorian-dt

math-absolute-from-gregorian-dt is a byte-compiled function defined in calc-forms.el.gz.

Signature

(math-absolute-from-gregorian-dt YEAR MONTH DAY)

Documentation

Return the DATE of the day given by the Gregorian day YEAR MONTH DAY.

Recall that DATE is the number of days since December 31, -1 in the Gregorian calendar.

Source Code

;; Defined in /usr/src/emacs/lisp/calc/calc-forms.el.gz
(defun math-absolute-from-gregorian-dt (year month day)
  "Return the DATE of the day given by the Gregorian day YEAR MONTH DAY.
Recall that DATE is the number of days since December 31, -1
in the Gregorian calendar."
  (when (zerop year)                    ; Year -1 precedes year 1.
    (setq year -1))
  (let* ((y (if (> year 0) year (+ year 1)))  ; Astronomical year (with 0).
         (y1 (- y 1)))                        ; Previous year.
    (+ (* y1 365)                    ; Days up to the previous year...
       (floor y1 4)                  ; ... including leap days.
       (- (floor y1 100))
       (floor y1 400)
       (math-day-in-year year month day))))