Select to view content in your preferred language

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

2425
1
Jump to solution
12-13-2021 01:25 AM
Aravinthkumar
Occasional Contributor

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
Regular Contributor

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
Regular Contributor

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