[Tutor] Python time hour formatting

tpc at csua.berkeley.edu tpc at csua.berkeley.edu
Thu Mar 25 17:15:23 EST 2004



hi everyone, quick question.  I currently have this:

time.strftime("%a %b %d, %Y  %I:%M:%S %p",time.localtime(time.time()))

to print out:

'Thu Mar 25, 2004  02:19:23 PM'

However, I don't want a leading zero in the hour column if
there is only one digit.  Is there a way to do this:

'Thu Mar 25, 2004   2:19:23 PM'

?

I already tried '%1I' to no avail.




More information about the Tutor mailing list