W3C home > Mailing lists > Public > www-archive@w3.org > November 2010

Format modifier suggestion for format-time-string

From: Edward O'Connor <hober0@gmail.com>
Date: Fri, 19 Nov 2010 11:23:09 -0800
Message-ID: <AANLkTimxeUJ5agMxEBYT4+1oEN=jYgUwpUoUfmvt9-qU@mail.gmail.com>
To: emacs-devel@gnu.org
Cc: www-archive@w3.org
Hi.

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,
Ted
Received on Friday, 19 November 2010 19:24:03 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 14:43:43 UTC