REBOL3 tracker
  0.9.12 beta
Ticket #0000438 User: anonymous

Project:



rss
TypeWish Statusreviewed Date24-Apr-2008 22:11
Versionalpha 31 Categoryn/a Submitted byhenrikmk
PlatformAll Severitytrivial Prioritylow

Summary Support for ISO 8601 date format
Description The formats are as follows. Exactly the components shown here must be present, with exactly this punctuation. Note that the "T" appears literally in the string, to indicate the beginning of the time element, as specified in ISO 8601.

Year:
YYYY (eg 1997)
Year and month:
YYYY-MM (eg 1997-07)
Complete date:
YYYY-MM-DD (eg 1997-07-16)
Complete date plus hours and minutes:
YYYY-MM-DDThh:mmTZD (eg 1997-07-16T19:20+01:00)
Complete date plus hours, minutes and seconds:
YYYY-MM-DDThh:mm:ssTZD (eg 1997-07-16T19:20:30+01:00)
Complete date plus hours, minutes, seconds and a decimal fraction of a
second
YYYY-MM-DDThh:mm:ss.sTZD (eg 1997-07-16T19:20:30.45+01:00)
Example code

			

Assigned ton/a Fixed in- Last Update19-Feb-2014 22:39


Comments
(0000316)
BrianH
20-Jan-2009 02:40

Sounds like a job for an addon module of date parsers.
(0003487)
Ladislav
24-Feb-2013 13:06

@Henrik Hmm, the "YYYY" format conflicts with Rebol integers, any idea what to do?
(0003488)
Ladislav
24-Feb-2013 13:07

@Henrik Also, the "YYYY-MM" format may be problematic - I am not sure how it shall be represented "internally" - shall it be represented as the first day of the respective month?
(0003489)
Ladislav
24-Feb-2013 13:33

My idea how to resolve this in a partially satisfactory way is to define a function like LOAD-ISO-8601 (or LOAD-IDATE better names, anyone?) working, e.g., as follows:

load-iso-8601 "1997" ; == 1/1/1997
load-iso-8601 "1997-02" ; == 1/2/1997

, etc.
(0003490)
rgchris
24-Feb-2013 16:52

RFC 3339 http://www.ietf.org/rfc/rfc3339.txt is a subset of ISO 8601 defined specifically for Internet timestamps. Current Rebol dates allowing "T" to separate dates and "Z" as a UTC zone marker would be consistent with this format.

"YYYY-MM-DDTHH:MM:SS(.SSS)Z"
(0003494)
BrianH
24-Feb-2013 19:19

Don't require anyone to remember an ISO number to figure out which function to use. When I implemented the Excel-compatible variant of the formatter for this in my CSV tools script (T is space, Z not supported), I called it TO-ISO-DATE, though that would be a better name for this function (which might benefit from an /excel option for its defacto standard syntax variant). Or maybe FORM-ISO-DATE because it is a formatting function, not a type conversion, though we have other examples which break that pattern. LOAD-ISO-DATE would be the corresponding loader, which should autodetect Excel dates too.
(0003544)
DideC
1-Mar-2013 00:32

Javascript has Date.toISOString() to form the date with T and Z. Yes I know, it's not an argument.
Using ISO in the name would sounds good as it is already used in other languages.
(0003545)
rgchris
1-Mar-2013 01:42

Should only need one function to format dates—either a strftime compatible function (like http://www.rebol.org/view-script.r?script=form-date.r or something based on 'reword) or a dialect. The tricky part is identifying dates in source/text.
(0004249)
BrianH
19-Feb-2014 22:39

Requested again in #2092.

Date User Field Action Change
19-Feb-2014 22:39 BrianH Comment : 0004249 Added -
1-Mar-2013 01:42 rgchris Comment : 0003545 Added -
1-Mar-2013 00:32 didec Comment : 0003544 Added -
24-Feb-2013 19:19 BrianH Comment : 0003494 Added -
24-Feb-2013 17:43 Ladislav Comment : 0003489 Modified -
24-Feb-2013 16:53 rgchris Comment : 0003490 Modified -
24-Feb-2013 16:52 rgchris Comment : 0003490 Modified -
24-Feb-2013 16:52 rgchris Comment : 0003490 Added -
24-Feb-2013 16:30 Ladislav Comment : 0003489 Modified -
24-Feb-2013 16:01 Ladislav Comment : 0003489 Modified -
24-Feb-2013 13:33 Ladislav Comment : 0003489 Added -
24-Feb-2013 13:07 Ladislav Comment : 0003488 Added -
24-Feb-2013 13:06 Ladislav Comment : 0003487 Added -
20-Jan-2009 02:40 BrianH Comment : 0000316 Added -
20-Jan-2009 02:40 BrianH Priority Modified none => low
20-Jan-2009 02:40 BrianH Version Modified => alpha 31
2-Dec-2008 18:50 Admin Ticket Added -