[issue665194] datetime-RFC2822 roundtripping

R. David Murray report at bugs.python.org
Thu Jul 14 01:04:38 CEST 2011


R. David Murray <rdmurray at bitdance.com> added the comment:

OK, here is a new patch proposal.  As suggested by Alexander, it adds two functions to email.utils: format_datetime and parsedate_to_datetime.  Adding these does not require having localtime.  In fact, with this patch you can get an aware datetime representing email's current best guess at localtime by doing:

   dt = parsedate_to_datetime(formatdate(localtime=True))

Reviews welcome, but this is simple enough I'll probably just commit it if no one objects.

----------
assignee: belopolsky -> r.david.murray
Added file: http://bugs.python.org/file22649/util_datetime.patch

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


More information about the Python-bugs-list mailing list