473,405 Members | 2,185 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

RFC 2822 format date printing function in python

Dear All,

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

regards,
Prabahar

__________________________________________________ ______________________
Yahoo! India Matrimony: Find your life partner online
Go to: http://yahoo.shaadi.com/india-matrimony
Jul 19 '05 #1
1 3875
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


Not as simple as PHP, but of course it's possible :-)
from email.Utils import formatdate
formatdate(localtime=True)

'Fri, 06 May 2005 18:00:20 +0900'

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

If you want to do the same thing with time module, you need a few
more lines to calcualate the timezone.

quote from footnote:

Note that the sign of the timezone offset is the opposite of the
sign of the time.timezone variable for the same timezone; the
latter variable follows the POSIX standard while this module
follows RFC 2822.
http://docs.python.org/lib/module-time.html

--
george
http://www.dynkin.com/
Jul 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Rusty Shackleford | last post by:
I have a Summer in front of me without any school, and I'd like to add a new format for python print strings that will show any number in a binary representation. For example: >>> '%b' % 3 11...
6
by: Franz Steinhaeusler | last post by:
Hello, with following function, i get a human readable date/time format. mtime = time.strftime(self.timeformat ,time.localtime(st.st_mtime)) However is there a simple solution to get a...
1
by: jt | last post by:
I posted this yesterday, but I am not seeing this out yet: I am having problems with updating a date field in a certain format. The data is stored in an Oracle database. The date is...
3
by: marwa mohamed | last post by:
salamo alikom hi all when i run report that includes image control linked to a field in the table that contains the image path(on the server)and the record source of the report contains over 30...
6
by: Stuart McGraw | last post by:
I am looking for a VBA "format" or "template" function, that is, a function that takes a format string and a varying number of arguments, and substitutes the argument values into the format string...
1
by: OleMacGeezer | last post by:
Hello Everyone, I am a brand new Python programmer with barely a month of experience under my belt. Here are my specs: Mac OSX Panther 10.3.9 Jython 2.1 implementation with Hermes BBS...
3
by: pamela fluente | last post by:
Hi, I wish to create a string from the current date now() so that it looks like the format used by Excel, for instance: 2006-04-16T19:45:42Z How would I achieve that?
18
by: Dirk Hagemann | last post by:
Hello, From a zone-file of a Microsoft Active Directory integrated DNS server I get the date/time of the dynamic update entries in a format, which is as far as I know the hours since january 1st...
2
by: necron99 | last post by:
import RuntimeEnvironment as renv import os, sys import win32com.client import getpass OMI = win32com.client.Dispatch("MOVEitAPI.clientObj") OMI.Host = system
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.