How can I get Python to display the time in eastern?
I\'ve looked over the python documentation but it\'s pretty confusing. I\'m using Python 3.
Thanks.
There is a much more intuitive way, of course:
from datetime import datetime
from pytz import timezone
tz = timezone('EST')
datetime.now(tz)
## this returns a datetime object pointing to right now
## according to the timezone info object handed in as the tz variable.
Alternatively you can define your own datetime
object and pass in tz
as tzinfo
, as you can see below:
datetime(2016, 3, 30, 11, 13, 24, tzinfo=tz)