[issue1982] Feature: extend strftime to accept milliseconds

M. Dietrich report at bugs.python.org
Tue Mar 24 12:30:22 CET 2009


M. Dietrich <mdt at pyneo.org> added the comment:

i am not shure what the code snippet shall proove but shouldnt't it read

from datetime import datetime
a_datetime = datetime.now()
a_datetime = a_datetime.replace(microsecond = 1)

iso_str = a_datetime.isoformat()
b_datetime = datetime.strptime(iso_str, "%Y-%m-%dT%H:%M:%S.%f")

assert(a_datetime == b_datetime)

? 

i general i would expect for each operation a reverse if possible to be
complete. so if there is a strftime, i look for a strptime, if there is
a isoformat, i like a isoparse. and to be complete i need a format tag
for ms if there is a microseconds member in datatime object.

----------
nosy: +mdt

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


More information about the Python-bugs-list mailing list