>>>> "mike" == mike kupfer
<mike.kupfer(a)sun.com> writes:
mike> Thanks for the additional tips.
>>>> "NK" == Norbert Koch
<viteno(a)xemacs.org> writes:
NK> (gnus-date-iso8601 "20020401")
NK> "19700101T010000"
NK> Uh oh.
mike> Indeed. But this works:
mike> (gnus-date-iso8601 "1 Apr 2002 00:00:00")
mike> "20020331T160000"
mike> Interestingly enough, gnus-date-iso8601 does not handle ISO format
mike> input correctly:
mike> (gnus-date-iso8601 "20020401T000000")
mike> "19991231T160000"
Nope, documentation says clearly:
`gnus-date-iso8601' (buffer: *scratch*, mode: Lisp Interaction)
Compiled Lisp function,
(loaded from "gnus-util"):
arguments: (date)
Convert the DATE to YYYYMMDDTHHMMSS.
^^
(gnus-date-iso8601 (current-time-string))
works.
However, it interprets its argument as UTC and returns a string
adjusted for local time zone. You'll have to pass it a UTC time to
get back a correct local time ISO8601 date and time.
E.g.:
(current-time-zone)
(7200 "W. Europe Daylight Time")
(current-time-string)
"Sat Oct 11 10:17:48 2003"
(gnus-date-iso8601 (current-time-string))
"20031011T121752"
T correctly indicates a local time, UTC times would be represented by
the letter Z.
Here is what I use:
(defun apa-time-to-iso8601 (&optional date-only time compact)
"Return ISO8601 current date or time string (for `current-time-zone').
If DATE-ONLY is non-nil, return the date only.
If TIME is non-nil, use it instead of current time.
If COMPACT is non-nil, return compact forms of date and/or time,
without time zone."
(require 'time-stamp)
(let*
((zone-secs (first (current-time-zone)))
(zone-hours (/ zone-secs 3600))
(zone-minutes (/ (% zone-secs 3600) 60))
(date-string (if compact
(time-stamp-strftime "%y%02m%02d" time)
(time-stamp-strftime "%y-%02m-%02d" time)))
(time-zone-string (format "%+03d%02d" zone-hours zone-minutes))
(time-string (if compact
(time-stamp-strftime "%02H:%02M" time)
(time-stamp-strftime "%02H:%02M:%02S" time))))
(if date-only
date-string
(if compact
(format "%s" time-string)
(format "%sT%s%s" date-string time-string time-zone-string)))))
(global-set-key '[(control ?c) ?i ?d]
(lambda (arg)
"Insert date-string at point, as produced by `apa-time-to-iso8601'.
Prefix argument produces a longer, more readable format."
(interactive "P")
(insert (apa-time-to-iso8601 'date-only nil (not arg)))))
(global-set-key '[(control ?c) ?i ?t]
(lambda (arg)
"Insert time-string at point, as produced by `apa-time-to-iso8601'.
Prefix argument produces a longer, more readable format, including
date and time-zone offset."
(interactive "P")
(insert (apa-time-to-iso8601 nil nil (not arg)))))
mike> Anyway, I'll ask ding(a)gnus.org about why messages are incorrectly
mike> being matched in my "before" score rules.
mike> cheers,
mike> mike
--
Adrian Aichner
mailto:adrianï¼ xemacs.org
http://www.xemacs.org/