Skip to content

Instantly share code, notes, and snippets.

@gtracy
Created January 12, 2014 03:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gtracy/8380239 to your computer and use it in GitHub Desktop.
Save gtracy/8380239 to your computer and use it in GitHub Desktop.
Using pytz, getting localized timestamps with Python on App Engine
def getLocalDatetime():
utc_dt = datetime.datetime.now()
central_tz = pytz.timezone('US/Central')
utc = pytz.utc
ltime = utc.localize(utc_dt).astimezone(central_tz)
return ltime
## end getLocalDatetime
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment