Ravi Kondamuru wrote: > I looked at datetime, but it seems slightly complex to work with non GMT > timestamps.
Mark Pilgrim's Universal Feed Parser includes a robust date parser that works with your sample: In [1]: import feedparser as fp In [2]: fp._parse_date('Mon Feb 11 01:34:52 CST 2008') Out[2]: (2008, 2, 11, 7, 34, 52, 0, 42, 0) http://www.feedparser.org/ This appears to be an RFC 2822-format date: http://www.faqs.org/rfcs/rfc2822.html feedparser uses these functions to parse the date string: In [4]: import rfc822 In [5]: rfc822.parsedate_tz('Mon Feb 11 01:34:52 CST 2008') Out[5]: (2008, 2, 11, 1, 34, 52, 0, 1, 0, -21600) In [7]: rfc822.mktime_tz(_5) Out[7]: 1202715292.0 In [8]: import time In [9]: time.gmtime(_7) Out[9]: (2008, 2, 11, 7, 34, 52, 0, 42, 0) The rfc822 module is deprecated; the same functions are now found in email.util. Kent _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor