Function: math-date-to-julian-dt

math-date-to-julian-dt is a byte-compiled function defined in calc-forms.el.gz.

Signature

(math-date-to-julian-dt DATE)

Documentation

Return the day (YEAR MONTH DAY) in the Julian calendar.

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-date-to-julian-dt (date)
  "Return the day (YEAR MONTH DAY) in the Julian calendar.
DATE is the number of days since December 31, -1 in the Gregorian calendar."
  (let* ((month 1)
         day
         (year (math-quotient (math-add date (if (Math-lessp date 711859)
                                                 367  ; for speed, we take
                                               -106)) ; >1950 as a special case
                              (if (math-negp date) 366 365)))
					; this result may be an overestimate
         temp)
    (while (Math-lessp date (setq temp (math-absolute-from-julian-dt year 1 1)))
        (setq year (math-add year -1)))
    (if (eq year 0) (setq year -1))
    (setq date (1+ (math-sub date temp)))
    (setq temp
          (if (math-leap-year-p year t)
              [1 32 61 92 122 153 183 214 245 275 306 336 999]
            [1 32 60 91 121 152 182 213 244 274 305 335 999]))
    (while (>= date (aref temp month))
      (setq month (1+ month)))
    (setq day (1+ (- date (aref temp (1- month)))))
    (list year month day)))