I'm working in an environment (AWS Lambda) where import pytz
doesn't work.
The environment is set to UTC.
How can I get the current time in the U.S. Pacific Timezone in this environment?
I need something simple, and low-maintenance. Somehow forcing import pytz
to work would be ideal, and I hope to avoid having to copy the entire pytz library into my own script.
Details
What have I tried so far? I tried using import pytz
, and it failed with module not found.
Example code? I tried this, straight from another question on SO:
import pytz
import datetime as DT
eastern = pytz.timezone('US/Eastern')
utc = pytz.utc
test = '2013-03-27 23:05'
If you don't have access to
pytz
in your environment, maybe you have access topython-dateutil
. In that case you can do: