* Format modifier suggestion for format-time-string
@ 2010-11-19 19:23 Edward O'Connor
2010-11-19 19:30 ` Lars Magne Ingebrigtsen
0 siblings, 1 reply; 6+ messages in thread
From: Edward O'Connor @ 2010-11-19 19:23 UTC (permalink / raw)
To: emacs-devel; +Cc: www-archive
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
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Format modifier suggestion for format-time-string
2010-11-19 19:23 Format modifier suggestion for format-time-string Edward O'Connor
@ 2010-11-19 19:30 ` Lars Magne Ingebrigtsen
2010-11-19 19:36 ` Edward O'Connor
0 siblings, 1 reply; 6+ messages in thread
From: Lars Magne Ingebrigtsen @ 2010-11-19 19:30 UTC (permalink / raw)
To: emacs-devel; +Cc: www-archive
"Edward O'Connor" <hober0@gmail.com> writes:
> 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 a coincidence. :-) I've been playing with dropping the gnulib
strftime.c into Emacs today, and that seems to make %:z work as required:
(format-time-string "%Y-%m-%d %H:%M:%S %:z")
=> "2010-11-19 20:29:33 +01:00"
I'm guessing this will be for Emacs 24, though.
--
(domestic pets only, the antidote for overdose, milk.)
larsi@gnus.org * Lars Magne Ingebrigtsen
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Format modifier suggestion for format-time-string
2010-11-19 19:30 ` Lars Magne Ingebrigtsen
@ 2010-11-19 19:36 ` Edward O'Connor
0 siblings, 0 replies; 6+ messages in thread
From: Edward O'Connor @ 2010-11-19 19:36 UTC (permalink / raw)
To: emacs-devel; +Cc: www-archive
Hi,
>> 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 a coincidence. :-)
No coincidence—it was that emacs-devel thread that reminded me of this
issue.
> I've been playing with dropping the gnulib strftime.c into Emacs
> today, and that seems to make %:z work as required:
I'm very happy to hear it!
> I'm guessing this will be for Emacs 24, though.
I suppose I'll go with something like this compatibility test for now:
(let ((test "%:z")) (string-equal test (format-time-string test)))
Thanks again,
Ted
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Format modifier suggestion for format-time-string
@ 2010-11-21 4:48 MON KEY
2010-11-21 17:47 ` Eli Zaretskii
0 siblings, 1 reply; 6+ messages in thread
From: MON KEY @ 2010-11-21 4:48 UTC (permalink / raw)
To: emacs-devel; +Cc: larsi, hober0
> I'm guessing this will be for Emacs 24, though.
This was topic was addressed circa August 2009 prior to release of Emacs 23 with
apparently too little time to integrate a similarly proposed feature.
See "Re: Can `format-time-string' produce full/extended ISO 8601 times?"
http://lists.gnu.org/archive/html/emacs-devel/2009-08/msg00262.html
Now its too little to late for 24?
Maybe we can expect this feature for Emacs 26...
--
/s_P\
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Format modifier suggestion for format-time-string
2010-11-21 4:48 MON KEY
@ 2010-11-21 17:47 ` Eli Zaretskii
2010-11-21 20:18 ` MON KEY
0 siblings, 1 reply; 6+ messages in thread
From: Eli Zaretskii @ 2010-11-21 17:47 UTC (permalink / raw)
To: MON KEY; +Cc: larsi, hober0, emacs-devel
> Date: Sat, 20 Nov 2010 23:48:43 -0500
> From: MON KEY <monkey@sandpframing.com>
> Cc: larsi@gnus.org, hober0@gmail.com
>
> > I'm guessing this will be for Emacs 24, though.
> [...]
> Now its too little to late for 24?
Please re-read the quotation. It says that Emacs 24 will have it
(because 23.3 is in pretest). It does NOT say that it's too late for
v24.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Format modifier suggestion for format-time-string
2010-11-21 17:47 ` Eli Zaretskii
@ 2010-11-21 20:18 ` MON KEY
0 siblings, 0 replies; 6+ messages in thread
From: MON KEY @ 2010-11-21 20:18 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: larsi, Edward O'Connor, emacs-devel
On Sun, Nov 21, 2010 at 12:47 PM, Eli Zaretskii <eliz@gnu.org> wrote:
>> Now its too little to late for 24?
>
> Please re-read the quotation. It says that Emacs 24 will have it
> (because 23.3 is in pretest). It does NOT say that it's too late for
> v24.
OK, Great!
Sorry if I misinterpreted the intent of Lars' assumption, I hope it is
well founded.
--
/s_P\
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2010-11-21 20:18 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-11-19 19:23 Format modifier suggestion for format-time-string Edward O'Connor
2010-11-19 19:30 ` Lars Magne Ingebrigtsen
2010-11-19 19:36 ` Edward O'Connor
-- strict thread matches above, loose matches on Subject: below --
2010-11-21 4:48 MON KEY
2010-11-21 17:47 ` Eli Zaretskii
2010-11-21 20:18 ` MON KEY
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.