time.localtime() Format Question

Greg Krohn greg at example.invalid
Sun Aug 20 13:53:16 EDT 2006


OleMacGeezer wrote:
> Hello Everyone,
> 

Hola

> (2006, 8, 19, 23, 39, 15, 5, 231, 0)
> 
> Well, that obviously was not what I wanted or needed. I don't
> need seconds, or whatever that is that follows after
> seconds...And that isn't the format I wanted either.

I'm sorry I didn't have time to grep your entire post, but maybe this 
will help:

 >>> import time
 >>> t = time.localtime()
 >>> t
(2006, 8, 20, 12, 48, 52, 6, 232, 1)
 >>> time.strftime('%a, %d %b %Y', t)
'Sun, 20 Aug 2006'

-greg



More information about the Python-list mailing list