Function: math-date-to-dt

math-date-to-dt is an autoloaded and byte-compiled function defined in calc-forms.el.gz.

Signature

(math-date-to-dt VALUE)

Documentation

Return the day and time of VALUE.

The integer part of VALUE is the number of days since Dec 31, -1 in the Gregorian calendar and the remaining part determines the time.

Source Code

;; Defined in /usr/src/emacs/lisp/calc/calc-forms.el.gz
(defun math-date-to-dt (value)
  "Return the day and time of VALUE.
The integer part of VALUE is the number of days since Dec 31, -1
in the Gregorian calendar and the remaining part determines the time."
  (if (eq (car-safe value) 'date)
      (setq value (nth 1 value)))
  (or (math-realp value)
      (math-reject-arg value 'datep))
  (let* ((parts (math-date-parts value))
	 (date (car parts))
	 (time (nth 1 parts))
         (dt (if (and calc-gregorian-switch
                      (Math-lessp value
                                  (or
                                   (nth 3 calc-gregorian-switch)
                                   (apply 'math-absolute-from-gregorian-dt calc-gregorian-switch))
))
                 (math-date-to-julian-dt date)
               (math-date-to-gregorian-dt date))))
    (if (math-integerp value)
        dt
      (append dt
              (list
               (/ time 3600)
               (% (/ time 60) 60)
               (math-add (% time 60) (nth 2 parts)))))))