How to get the created date and Updated date of a map in portal using ArcGIS API python

495
1
Jump to solution
12-13-2021 01:25 AM
Aravinthkumar
New Contributor III

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. 

Tags (3)
0 Kudos
1 Solution

Accepted Solutions
SimonGIS
New Contributor III

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))

View solution in original post

1 Reply
SimonGIS
New Contributor III

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))