classification
Title: datetime.strptime does not implement %z
Type: behavior Stage:
Components: Library (Lib) Versions: Python 2.7
process
Status: closed Resolution: out of date
Dependencies: Superseder:
Assigned To: Nosy List: belopolsky, zwn
Priority: normal Keywords:

Created on 2013-03-03 14:25 by zwn, last changed 2013-06-07 14:42 by belopolsky. This issue is now closed.

Messages (2)
msg183379 - (view) Author: Zbyněk Winkler (zwn) Date: 2013-03-03 14:25
According to http://docs.python.org/2/library/datetime.html#strftime-strptime-behavior the %z directive is used to specify the timezone offset  of the form +HHMM or -HHMM. However it is not implemented in datetime.strptime.

I'd prefer to have %z available in strptime but if not having it is a deliberate decision I think it should be mentioned in the documentation as not to confuse users.
msg190749 - (view) Author: Alexander Belopolsky (belopolsky) * (Python committer) Date: 2013-06-07 14:42
Python 2.x is in maintenance mode and will not receive new features.  In 3.x this is already implemented:

Python 3.3.2 (default, May 24 2013, 22:46:58)
[GCC 4.2.1 Compatible Apple LLVM 4.2 (clang-425.0.28)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from datetime import *
>>> print(datetime.strptime('20010101 010101 -0400', '%Y%m%d %H%M%S %z'))
2001-01-01 01:01:01-04:00
History
Date User Action Args
2013-06-07 14:42:01belopolskysetstatus: open -> closed

nosy: + belopolsky
messages: + msg190749

resolution: out of date
2013-03-03 14:25:10zwncreate