unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: MON KEY <monkey@sandpframing.com>
To: Juri Linkov <juri@jurta.org>
Cc: emacs-devel@gnu.org
Subject: Re: Can `format-time-string' produce full/extended ISO 8601 times?
Date: Thu, 6 Aug 2009 14:39:20 -0400	[thread overview]
Message-ID: <d2afcfda0908061139o2be96033vf66ebdbf704e61e7@mail.gmail.com> (raw)
In-Reply-To: <878wi1epta.fsf@mail.jurta.org>

2009/8/2 Juri Linkov <juri@jurta.org>:
>> Does `format-time-string' produce full/extended ISO 8601 format times?
>
> 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:

Wasn't a complaint at all.

FTMP `format-time-string' does _exactly_ what one would expect.

To reiterate, the gist of my query is this:

  Is it possible to format the UTC offset/ZONE with a colon per the
'Extended format?

From what I am able to gather the "%z" of the `format-time-string'
spec doesn't produce a colon delimited UTC-offset/ZONE and provides
only for production of the time-numoffset as:

+/-time-hourtime-minute -> +/- hhmm  -> "-0500"

To the extent that the standard is unclear/ambiguous, stating that:

'For example, to produce full ISO 8601 format, use "%Y-%m-%dT%T%z".'

can not be correct as there is no 'full ISO 8601' format; e.g. the
following is not 'full' but only full-ish :)

(format-time-string "%Y-%m-%dT%T%z")
=> "2009-08-06T13:50:23-0400" ; On a w32 system.

This would _appear_ to stand in contrast the referenced section of the
standard, e.g. '4.2.5.1-2 of ISO 8601:2004(E)' which permits at least
two other possible variations:

The 'Basic format' is one of these:

  +/-time-hour            ->  +/-hh     -> "-05"
  +/-time-hourtime-minute ->  +/- hhmm  -> "-0500"

With the later variant of the basic format considered _more_ specific
than the former.

My specific concern is w/re to the standards proviso for an extended
format such that:

  +/-time-hour:time-minute ->  +/- hh:mm  -> "-05:00"

>
>  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]
>

As you point out, _here_ the standard is ambiguous as to canonical
preference and permissible deviations. That said - as I read the
standard - it would seem that when in doubt the Extended (and where
applicable delimited) format is generally considered _more_ preferable
than the Basic. Regardless, apropos my initial query, whether this
particular reading is correct need not be of concern.  Rather, I
remain curious to know if it is _possible_ to produce a time string
with a UTC/ZONE portion having the format:

 +/-time-hour:time-minute ->  +/- hh:mm  -> "-05:00"  ; _with_ colon delimiter

Specifically, I am inquiring whether such production is possible with
the current existing `format-time-string' (sans extension).

If so, this should be be made clear in the docs. If not, the docs
should be modified to indicate:

'For example, to produce an ISO 8601 compliant format, use "%Y-%m-%dT%T%z".'

as contrasted with the current:

'For example, to produce full ISO 8601 format, use "%Y-%m-%dT%T%z".'

Further, if a production of UTZ/Zone colon delimited timestring is not
possible and it does not pose significant runtime/source overhead I
would propose consideration for inclusion of an additional "%Z" format
spec to `format-time-string'.

> Juri Linkov

s_P




  reply	other threads:[~2009-08-06 18:39 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
2009-08-06 18:39   ` MON KEY [this message]
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=d2afcfda0908061139o2be96033vf66ebdbf704e61e7@mail.gmail.com \
    --to=monkey@sandpframing.com \
    --cc=emacs-devel@gnu.org \
    --cc=juri@jurta.org \
    /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).