From: liw at iki.fi (Lars Wirzenius) Date: 13 Apr 1999 19:59:35 GMT Subject: rfc822 date header References: <37136310.62A6BE1A@rubic.com> Message-ID: <7f07n7$7pqv$1@midnight.cs.hut.fi> Content-Length: 1048 X-UID: 235 jeffbauer at bigfoot.com: > def strdate(self, timeval=None): > from time import gmtime, strftime, time > if timeval is None: > timeval = time() > return "Date: %s" % strftime('%a, %d %b %Y %H:%M:%S GMT', > gmtime(timeval)) Here's what I wrote for Slime (thhe mailer I'm writing): def _date_header(self): """Return Date header reflecting current time.""" # XXX this should probably communicate the local time zone # somehow t = time.gmtime(time.time()) return "Date: %s, %02d %s %04d %02d:%02d:%02d GMT\n" % \ (rfc822._daynames[t[6]], t[2], rfc822._monthnames[t[1]], t[0], t[3], t[4], t[5]) Note that it isn't locale dependent. (I apologize for the bad indentation of a whole tab, I haven't got around to implementing proper indentation support in my editor.)