emacs-devel
[Top][All Lists]
Advanced

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

Can `format-time-string' produce full/extended ISO 8601 times?


From: MON KEY
Subject: Can `format-time-string' produce full/extended ISO 8601 times?
Date: 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"

-----
GNU Emacs 23.1.50.1 (i386-mingw-nt5.1.2600)
 of 2009-06-30 on LENNART-69DE564 (patched)

s_P




reply via email to

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