Function: time-to-days

time-to-days is an autoloaded and byte-compiled function defined in time-date.el.gz.

Signature

(time-to-days TIME)

Documentation

The absolute pseudo-Gregorian date for TIME, a time value.

The absolute date is the number of days elapsed since the imaginary Gregorian date Sunday, December 31, 1 BC.

View in manual

Probably introduced at or before Emacs version 25.1.

Source Code

;; Defined in /usr/src/emacs/lisp/calendar/time-date.el.gz
;;;###autoload
(defun time-to-days (time)
  "The absolute pseudo-Gregorian date for TIME, a time value.
The absolute date is the number of days elapsed since the imaginary
Gregorian date Sunday, December 31, 1 BC."
  (let* ((tim (decode-time time))
	 (year (decoded-time-year tim)))
    (+ (time-date--day-in-year tim)	;	Days this year
       (* 365 (1- year))		;	+ Days in prior years
       (/ (1- year) 4)			;	+ Julian leap years
       (- (/ (1- year) 100))		;	- century years
       (/ (1- year) 400))))		;	+ Gregorian leap years