[issue15873] "datetime" cannot parse ISO 8601 dates and times
Roy Smith
report at bugs.python.org
Sun Sep 9 14:15:03 CEST 2012
Roy Smith added the comment:
We need to define the scope of what input strings will be accepted. ISO-8601 defines a lot of stuff which we may not wish to accept.
Do we want to accept both basic format (YYYYMMDD) and extended format (YYYY-MM-DD)?
Do we want to accept things like "1985-W15-5", which is (if I understand this correctly(), the 5th day of the 15th week of 1985 [section 4.1.4.2].
Do we want to accept [section 4.2.2.4], "23:20,8", which is 23 hours, 20 minutes, 8 tenths of a minute.
I suspect most people who have been following the recent thread (https://groups.google.com/d/topic/comp.lang.python/Q2w4R89Nq1w/discussion) would say none of the above are needed. All that's needed is if you have an existing datetime object, d1, you can do:
s = str(d1)
d2 = datetime.datetime(s)
assert d1 == d2
for all values of d1.
But, let's at least agree on that. Or, in the alternative, agree on something else. Then we know what we're shooting for.
----------
nosy: +roysmith
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue15873>
_______________________________________
More information about the Python-bugs-list
mailing list