[issue24954] No way to generate or parse timezone as produced by datetime.isoformat()

Antti Haapala report at bugs.python.org
Sat Jul 16 13:26:26 EDT 2016


Antti Haapala added the comment:

Alexander: that is true, because they are *separate* conversion flags. 

However even the POSIX standard strptime has some leniency: '%m` and `%d` accept the numbers *without* leading zeroes. This actually also means that one cannot use `%Y%m%d` to detect an invalid ISO timestamp:

    >>> datetime.datetime.strptime('111122', '%Y%m%d')
    datetime.datetime(1111, 2, 2, 0, 0)

The `arrow` library depends on the supposed "strict" behaviour of strptime that has never been guaranteed, which often results in very buggy behaviour under some conditions.

----

(Also, it must be noted that GNU date program doesn't use these formats to *parse* dates, and POSIX strptime in *C* library outright ignores any timezone information)

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue24954>
_______________________________________


More information about the Python-bugs-list mailing list