[issue7584] datetime.rfcformat() for Date and Time on the Internet

anatoly techtonik report at bugs.python.org
Sun May 9 15:32:00 CEST 2010


anatoly techtonik <techtonik at gmail.com> added the comment:

Let's quote RFC 3339:
"""
4.3. Unknown Local Offset Convention

   If the time in UTC is known, but the offset to local time is unknown,
   this can be represented with an offset of "-00:00".  This differs
   semantically from an offset of "Z" or "+00:00", which imply that UTC
   is the preferred reference point for the specified time.  RFC2822
   [IMAIL-UPDATE] describes a similar convention for email.
"""

The phrase "this CAN be represented" doesn't mean that it SHOULD be represented. Do we have information to decide if offset to local zone is unknown or if UTC is the preferred reference point for specified time? I guess no, and I am afraid that most users just don't care or don't want to bog into details - all they need is a good Atom looking timestamp. As we are not aiming at making a reference library for generating all possible forms of valid RFC 3339 timestamps, it makes sense to use 'Z' in the end because it is easier to handle.

rfcformat(dt).replace("Z", "-00:00") in case somebody need a -00:00 is easier than reverse operation if you need 'Z' in the end:

dstr = rfcformat(dt)
if dstr.endswith("-00:00") or dstr.endswith("+00:00"):
    dstr = dstr[:-6] + 'Z'

----------

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


More information about the Python-bugs-list mailing list