Skip to content

Instantly share code, notes, and snippets.

@oevans
Last active December 20, 2015 07:29
Show Gist options
  • Select an option

  • Save oevans/6093614 to your computer and use it in GitHub Desktop.

Select an option

Save oevans/6093614 to your computer and use it in GitHub Desktop.
Converting ArcGIS Online UNIX time to a standard readable date/time format
# Modify time formatting codes (e.g., "%Y", etc.) as needed using values from table in python docs here:
# http://docs.python.org/2/library/time.html#time.strftime
# Replace <AGO DATE/TIME> with your time value/variable
import time
time.strftime("%Y-%m-%d %I:%M:%S %p (%Z)",time.localtime(<AGO DATE/TIME>/1000))
# SAMPLE RESULT - '2013-07-31 11:59:33 PM (Eastern Daylight Time)'
##########
# alternate usage -- selects your locale's appropriate date/time representation
import time
time.strftime("%c (%Z)",time.localtime(<AGO DATE/TIME>/1000))
# SAMPLE RESULT - '07/31/13 23:59:33 (Eastern Daylight Time)'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment