[Tutor] Problems with date

Kent Johnson kent37 at tds.net
Fri Feb 2 11:54:23 CET 2007


Mário Gamito wrote:
> Hi,
> 
> I have this instruction
> 
> print item.date that outputs
> 
> (2007, 1, 23, 18, 35, 33, 1, 23, 0)
> 
> What i'd like to do is to convert it to, for example
> 
> 23-01-2007 18:35:33

That is a struct_time tuple such as would be returned by 
time.localtime() for example. Use time.strftime() to format it the way 
you want.
http://docs.python.org/lib/module-time.html

Kent



More information about the Tutor mailing list