Get "2:35pm" instead of "02:35PM" from Python date/time?
Posted
by anonymous coward
on Stack Overflow
See other posts from Stack Overflow
or by anonymous coward
Published on 2010-05-27T21:48:08Z
Indexed on
2010/05/27
21:51 UTC
Read the original article
Hit count: 138
I'm still a bit slow with Python, so I haven't got this figured out beyond what's obviously in the docs, etc.
I've worked with Django a bit, where they've added some datetime formatting options via template tags, but in regular python code how can I get the 12-hour hour without a leading zero?
Is there a straightforward way to do this? I'm looking at the 2.5 and 2.6 docs for "strftime()" and there doesn't seem to be a formatting option there for this case.
Should I be using something else?
Feel free to include any other time-formatting tips that aren't obvious from the docs. =)
© Stack Overflow or respective owner