ConfusedLuigi ConfusedLuigi - 1 year ago 57
Python Question

Get right timezone information when using datetime.datetime.now()?

I'm trying to get the date in datetime.datetime.now() format but for MT time in Python 2.7.

If you suggest using a library please explain how to install it. Thanks.

Answer Source
from pytz import timezone
from datetime import datetime
datetime.now(timezone('US/Mountain'))

That's what you probably need. As for installing the library, just pip install pytz