Function: article-make-date-line
article-make-date-line is a byte-compiled function defined in
gnus-art.el.gz.
Signature
(article-make-date-line DATE TYPE)
Documentation
Return a DATE line of TYPE.
Source Code
;; Defined in /usr/src/emacs/lisp/gnus/gnus-art.el.gz
(defun article-make-date-line (date type)
"Return a DATE line of TYPE."
(unless (memq type '(local ut original user-defined iso8601 lapsed english
combined-lapsed combined-local-lapsed))
(error "Unknown conversion type: %s" type))
(condition-case ()
(let ((time (ignore-errors (date-to-time date))))
(cond
;; Convert to the local timezone.
((eq type 'local)
(concat "Date: " (message-make-date time)))
;; Convert to Universal Time.
((eq type 'ut)
(let ((system-time-locale "C"))
(format-time-string
"Date: %a, %d %b %Y %T UT"
(encode-time (parse-time-string date))
t)))
;; Get the original date from the article.
((eq type 'original)
(concat "Date: " (if (string-match "\n+$" date)
(substring date 0 (match-beginning 0))
date)))
;; Let the user define the format.
((eq type 'user-defined)
(let ((format (or (condition-case nil
(with-current-buffer gnus-summary-buffer
gnus-article-time-format)
(error nil))
gnus-article-time-format)))
(if (functionp format)
(funcall format time)
(concat "Date: " (format-time-string format time)))))
;; ISO 8601.
((eq type 'iso8601)
(format-time-string "Date: %Y%m%dT%H%M%S%z" time))
;; Do a lapsed format.
((eq type 'lapsed)
(concat "Date: " (article-lapsed-string time)))
;; A combined date/lapsed format.
((eq type 'combined-lapsed)
(article-make-date-combine-with-lapsed date time 'original))
;; A combined local/lapsed format.
((eq type 'combined-local-lapsed)
(article-make-date-combine-with-lapsed date time 'local))
;; Display the date in proper English
((eq type 'english)
(let ((dtime (decode-time time)))
(concat
"Date: the "
(number-to-string (decoded-time-day dtime))
(let ((digit (% (decoded-time-day dtime) 10)))
(cond
((memq (decoded-time-day dtime) '(11 12 13)) "th")
((= digit 1) "st")
((= digit 2) "nd")
((= digit 3) "rd")
(t "th")))
" of "
(nth (1- (decoded-time-month dtime)) gnus-english-month-names)
" "
(number-to-string (decoded-time-year dtime))
" at "
(format "%02d" (decoded-time-hour dtime))
":"
(format "%02d" (decoded-time-minute dtime)))))))
(foo
(format "Date: %s (from Gnus)" date))))