I am trying to get the created date and the last updated date of all the Maps in my portal, is there any function to get both the dates using ArcGIS API python. Kindly direct me. Thank you.
Solved! Go to Solution.
This should work
from arcgis.gis import GIS
from datetime import datetime
gis = GIS(profile='simon')
# Find all the web maps
all_maps = gis.content.search(query="*", item_type="Web Map", max_items = 9999)
# Return the date created + modified
for m in all_maps:
m_created_time = datetime.fromtimestamp(round(m.created / 1000))
m_modified_time = datetime.fromtimestamp(round(m.modified / 1000))
print(m.title + ", Created: " + str(m_created_time) + ", Modified: "+ str(m_modified_time))
This should work
from arcgis.gis import GIS
from datetime import datetime
gis = GIS(profile='simon')
# Find all the web maps
all_maps = gis.content.search(query="*", item_type="Web Map", max_items = 9999)
# Return the date created + modified
for m in all_maps:
m_created_time = datetime.fromtimestamp(round(m.created / 1000))
m_modified_time = datetime.fromtimestamp(round(m.modified / 1000))
print(m.title + ", Created: " + str(m_created_time) + ", Modified: "+ str(m_modified_time))