[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Format modifier suggestion for format-time-string

From: Edward O'Connor
Subject: Format modifier suggestion for format-time-string
Date: Fri, 19 Nov 2010 11:23:09 -0800


When generating data formats that rely on RFC 3339 date and time formats
(Atom, say) in elisp, I've often found myself having to do something
like this:

(defun rfc3339-datetime (&optional time)
  (let ((stamp (format-time-string "%Y-%m-%dT%H:%M:%S%z" time)))
    (format "%s:%s" (substring stamp 0 -2) (substring stamp -2))))

In RFC 3339, the colon separating hours and minutes within a time zone
offset is mandatory, but `format-time-string' doesn't have the ability
to generate time zone offsets with a colon in them.

I'd like to suggest the addition of a : modifier, such that
(format-time-string "%:z") would generate an RFC 3339-compatible time
zone offset.

What do you think?

Thanks for the consideration,

reply via email to

[Prev in Thread] Current Thread [Next in Thread]