"praba kar" wrote:

>    In Php we can print RFC 2822 formatted date by
> date('r') with parameter r.  Then it will print the
> below format date.
> "Thu,  7 Apr 2005 01:46:36 -0300".
> I want to print same RFC 2822 format in python. Is it
> possible in python? . If possible kindly mention the
> function related to print RFC format date

here's what I replied the last time you asked about RFC 2822 dates:

    the timestamp format you're using is also known as the RFC(2)822 format.
    the "email" package contains several functions to deal with this format:

    >>> x = 1112962934
    >>> from email.Utils import formatdate
    >>> formatdate(x) # default is utc 'Fri, 08 Apr 2005 12:22:14 -0000'
    >>> formatdate(x, localtime=1)
    'Fri, 08 Apr 2005 14:22:14 +0200'

    >>> from email.Utils import parsedate_tz
    >>> parsedate_tz(formatdate(x, localtime=1))
    (2005, 4, 8, 14, 22, 14, 0, 1, 0, 7200)

    for the full story, see:

        http://docs.python.org/lib/module-email.Utils.html

you may want to save copies of questions you've already asked, and
the replies you got, so you can avoid asking the same questions over
and over again.  (yes, this also applies if you're a bot).

</F>



-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to