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

Daniel Urban report at bugs.python.org
Fri Apr 30 14:05:58 CEST 2010


Daniel Urban <urban.dani+py at gmail.com> added the comment:

> The point is that your implementation doesn't allow people to generate
> 'Z'-ending timestamp if they need a subset of rfc3339.

That is exactly right. Do you have any suggestion, how to do that? Maybe an optional argument to the rfcformat method? Something like:

def new_rfcformat(self, default_utcoffset='-00:00'):
    if we_know_the_utc_offset:
        return self.rfcformat() # the method in my current patch
    else:
        return self.isoformat() + default_utcoffset

This way, if somebody want 'Z' instead of '-00:00', just calls the method like this:

d.new_rfcformat('Z')

Though this way '+00:00' wouldn't get replaced by 'Z'. 
Any suggestions?

----------

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


More information about the Python-bugs-list mailing list