Function: date-to-time
date-to-time is an autoloaded and byte-compiled function defined in
time-date.el.gz.
Signature
(date-to-time DATE)
Documentation
Parse a string DATE that represents a date-time and return a time value.
DATE should be in one of the forms recognized by parse-time-string.
If DATE lacks timezone information, GMT is assumed.
Source Code
;; Defined in /usr/src/emacs/lisp/calendar/time-date.el.gz
;;;###autoload
;; `parse-time-string' isn't sufficiently general or robust. It fails
;; to grok some of the formats that timezone does (e.g. dodgy
;; post-2000 stuff from some Elms) and either fails or returns bogus
;; values. timezone-make-date-arpa-standard should help.
(defun date-to-time (date)
"Parse a string DATE that represents a date-time and return a time value.
DATE should be in one of the forms recognized by `parse-time-string'.
If DATE lacks timezone information, GMT is assumed."
(condition-case err
(encode-time (parse-time-string date))
(error
(let ((overflow-error '(error "Specified time is not representable")))
(if (equal err overflow-error)
(signal (car err) (cdr err))
(condition-case err
(encode-time (parse-time-string
(timezone-make-date-arpa-standard date)))
(error
(if (equal err overflow-error)
(signal (car err) (cdr err))
(error "Invalid date: %s" date)))))))))