How do I print a Python datetime in the local timezone?

Posted by mike on Stack Overflow See other posts from Stack Overflow or by mike
Published on 2009-07-10T18:50:59Z Indexed on 2010/04/29 19:17 UTC
Read the original article Hit count: 253

Filed under:

Let's say I have a variable t that's set to this:

datetime.datetime(2009, 7, 10, 18, 44, 59, 193982, tzinfo=<UTC>)

If I say str(t), i get:

'2009-07-10 18:44:59.193982+00:00'

How can I get a similar string, except printed in the local timezone rather than UTC?

© Stack Overflow or respective owner

Related posts about python