[Baypiggies] HTTP date format
itz at buug.org
Wed Feb 17 16:28:58 EST 2016
On 2016-02-17 20:58 +0000, Alex Young wrote:
> datetime(1994, 11, 6, 8, 49, 37, 0, GMT()).strftime('%a, %d %b %Y %H:%M:%S
Same trouble as always: I ask a question after thinking hard about a
problem and seeing the difficulties, and I assume others see the
difficulties as well :-(
Here, the main difficulty (the one which made me stop hacking and ask)
is that strftime is locale dependent, while the RFC demands fixed
In the meantime I came up with this pearl:
real_loc = locale.getlocale(locale.LC_ALL)
gmtuple = time.gmtime(timestamp)
return time.strftime('%a, %d %b %Y %H:%M:%S', gmtuple) + ' GMT'
Do you think it has a chance in hell of working? Note: portability to
Windows is not important, portability to MacOS only mildly interesting.
Please *no* private copies of mailing list or newsgroup messages.
Rule 420: All persons more than eight miles high to leave the court.
More information about the Baypiggies