strtotime?

Torzec Nicolas nicolas.torzec at enssat.fr
Wed Jan 28 09:46:10 EST 2004


have a look at the parsedate() method in the RFC822 package.
It may help you if your date is in "Internet format"

"parsedate(StringDate)
Attempts to parse a date according to the rules in RFC 2822. however, 
some mailers don't follow that format as specified, so parsedate() tries 
to guess correctly in such cases. date is a string containing an RFC 
2822 date, such as 'Mon, 20 Nov 1995 19:12:08 -0500'. If it succeeds in 
parsing the date, parsedate() returns a 9-tuple that can be passed 
directly to time.mktime(); otherwise None will be returned. Note that 
fields 6, 7, and 8 of the result tuple are not usable."


Leif K-Brooks wrote:
> PHP has a very nice strtotime function (http://php.net/strtotime) which 
> converts a date/time in virtually any format into a timestamp. Does 
> Python have a similar function?
> 





More information about the Python-list mailing list