Comma Comma Comma 8601

Started by David E. Wheelerover 12 years ago4 messages
#1David E. Wheeler
david@justatheory.com

Hackers,

According to [Wikipedia](https://en.wikipedia.org/wiki/ISO_8601#Times):

Decimal fractions may also be added to any of the three time elements. A decimal mark, either a comma or a dot (without any preference as stated in resolution 10 of the 22nd General Conference CGPM in 2003,[11] but with a preference for a comma according to ISO 8601:2004)[12] is used as a separator between the time element and its fraction. A fraction may only be added to the lowest order time element in the representation. To denote "14 hours, 30 and one half minutes", do not include a seconds figure. Represent it as "14:30,5", "1430,5", "14:30.5", or "1430.5". There is no limit on the number of decimal places for the decimal fraction. However, the number of decimal places needs to be agreed to by the communicating parties.

I assume that the Postgres project has no interest in supporting the input of whack times like “14:30.5”, “1430.5”, “14:30.5”, or “1430.5”, right? I mean, that’s just bizarre, amirite?

But I do wonder if the comma should be allowed for fractional seconds, since the spec says it is preferred (and often used in Javaland, I’m told). As in “14:30:50,232”. Thoughts?

Best,

David

PS: Apologies if you somehow ended up with a bad 80s pop song in your head.

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: David E. Wheeler (#1)
Re: Comma Comma Comma 8601

"David E. Wheeler" <david@justatheory.com> writes:

But I do wonder if the comma should be allowed for fractional seconds,
since the spec says it is preferred (and often used in Javaland, I'm
told). As in "14:30:50,232". Thoughts?

Does that create any ambiguities against formats we already support?
I'm worried about examples like this one:

select 'monday, july 22, 22:30 2013'::timestamptz;
timestamptz
------------------------
2013-07-22 22:30:00-04
(1 row)

Right now I'm pretty sure that the datetime parser treats comma as a
noise symbol. If that stops being true, we're likely to break some
applications out there (admittedly, possibly rather strange ones,
but still ...)

regards, tom lane

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

#3David E. Wheeler
david@justatheory.com
In reply to: Tom Lane (#2)
Re: Comma Comma Comma 8601

On Jul 23, 2013, at 1:17 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:

Does that create any ambiguities against formats we already support?
I'm worried about examples like this one:

select 'monday, july 22, 22:30 2013'::timestamptz;
timestamptz
------------------------
2013-07-22 22:30:00-04
(1 row)

Right now I'm pretty sure that the datetime parser treats comma as a
noise symbol. If that stops being true, we're likely to break some
applications out there (admittedly, possibly rather strange ones,
but still ...)

I kind of suspect not, since this fails:

david=# select '12:24:53 654'::time;
ERROR: invalid input syntax for type time: "12:24:53 654"
LINE 1: select '12:24:53 654'::time;
^

I would have guessed that the time parser gets to a state where it knows it is dealing with a ISO-8601-style time. But I have not looked at the code, of course.

David

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

#4David E. Wheeler
david@justatheory.com
In reply to: David E. Wheeler (#3)
Re: Comma Comma Comma 8601

On Jul 23, 2013, at 6:24 PM, David E. Wheeler <david@justatheory.com> wrote:

I kind of suspect not, since this fails:

david=# select '12:24:53 654'::time;
ERROR: invalid input syntax for type time: "12:24:53 654"
LINE 1: select '12:24:53 654'::time;
^

I would have guessed that the time parser gets to a state where it knows it is dealing with a ISO-8601-style time. But I have not looked at the code, of course.

I added this to the To Dos so it won’t get lost.

https://wiki.postgresql.org/wiki/Todo#Dates_and_Times

Best,

David

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers