getting date into rfc822 format

Jon J. Morin rotundo52 at hotmail.com
Sun Jul 21 00:28:12 EDT 2002


Hi all.  I'm writing a program that sends email in an environment that does 
not have sendmail or similar MTA.  I am trying to prepend the date to the 
headers of the email, but many mail clients that I have tested it with show 
the date as unknown when the message comes in.  Here is how I come up with 
the date:

import time

date = time.ctime(time.time())


Which gives me a date like this:
Sat Jul 20 00:02:03 2002

When what I want is something like this:
Fri, 01 Mar 2002 00:18:17 -0500 (EST)

Incidentally, I have read the rfc822 and I can't figure out what the -0500 
is in the date/time.  Can anyone explain this to me?

Jon J. Morin
University of Maine at Augusta



More information about the Python-list mailing list