unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@jurta.org>
To: MON KEY <monkey@sandpframing.com>
Cc: emacs-devel@gnu.org
Subject: Re: Can `format-time-string' produce full/extended ISO 8601 times?
Date: Mon, 03 Aug 2009 02:52:49 +0300	[thread overview]
Message-ID: <878wi1epta.fsf@mail.jurta.org> (raw)
In-Reply-To: <d2afcfda0907301510m546ac399te49ddbb966e47ccb@mail.gmail.com> (MON KEY's message of "Thu, 30 Jul 2009 18:10:26 -0400")

> Does `format-time-string' produce full/extended ISO 8601 format times?
>
> -
> Docstring of `format-time-string' states:
>
>  "For example, to produce full ISO 8601 format, use "%Y-%m-%dT%T%z"."
>
> As best I can gather this is _not_ a 'full' ISO 8601 time string format.
> Specifically, section 4.2.5.1-2 of ISO 8601:2004(E)
>
> --
> 4.2.5.1 Difference between local time and UTC of day
>
> Basic format:      ±hhmm             Example: +0100
>                      ±hh                      +01
>
> Extended format:   ±hh:mm            Example: +01:00
>
> --
> 4.2.5.2 Local time and the difference from UTC
>
> Basic format:      hhmmss±hhmm       Example: 152746+0100
>                                               152746−0500
>                    hhmmss±hh                  152746+01
>                                               152746−05
>
> Extended format:   hh:mm:ss±hh:mm    Example: 15:27:46+01:00
>                                               15:27:46−05:00
>                    hh:mm:ss±hh                15:27:46+01
>                                               15:27:46−05
>
> ---
> I am referencing from the .pdf available here:
> (URL `http://isotc.iso.org/livelink/livelink/4021199/ISO_8601_2004_E.zip?func=doc.Fetch&nodeid=4021199')
>
> ----
> Is it possible to format the UTC offset/ZONE with a colon per the
> Extended format above?
>
> On a w32 system I'm get these results:
>
> (format-time-string "%Y-%m-%dT%T%z")
> ;=>"2009-07-30T18:04:56-0400"
>
> (format-time-string "%Y-%m-%dT%T,%u%z")
> ;=>"2009-07-30T18:04:36,4-0400"
>
> (format-time-string "%Y-%m-%dT%T,%u%z" nil t)
> "2009-07-30T22:05:47,4+0000Z"
>
> (format-time-string "%Y-%m-%dT%T,%u%z" (current-time) t)
> ;=>"2009-07-30T22:06:10,4+0000"

Do you complain that `format-time-string' uses the extended format for
date/time and the basic format for time zone?  Well, RFC 3339 says:

  Due to ambiguities in ISO 8601, some interpretations had to
  be made.  First, ISO 8601 is not clear if mixtures of basic and
  extended format are permissible.

And provides a grammar that permits mixtures:

  time-numoffset    = ("+" / "-") time-hour [[":"] time-minute]

-- 
Juri Linkov
http://www.jurta.org/emacs/




  reply	other threads:[~2009-08-02 23:52 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-30 22:10 Can `format-time-string' produce full/extended ISO 8601 times? MON KEY
2009-08-02 23:52 ` Juri Linkov [this message]
2009-08-06 18:39   ` MON KEY
2009-08-06 18:47     ` Edward O'Connor
2009-08-06 20:41     ` Juri Linkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=878wi1epta.fsf@mail.jurta.org \
    --to=juri@jurta.org \
    --cc=emacs-devel@gnu.org \
    --cc=monkey@sandpframing.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).