<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic ARCPY and lyrtime in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/arcpy-and-lyrtime/m-p/1327675#M72951</link>
    <description>&lt;P&gt;I do not understand where to insert my variables.&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;import arcpy
lyrFile = arcpy.mp.LayerFile(r'C:\Projects\Time\ShipPositions.lyrx')
for lyr in lyrFile.listLayers():
    if lyr.supports('TIME'):
        if lyr.isTimeEnabled:
            lyrTime = lyr.time
            startTime = lyrTime.startTime
            endTime = lyrTime.endTime
            timeDelta = endTime - startTime
            print(f"Layer: {lyr.name}")
            print(f"  Start Time: {str(startTime.strftime('%m-%d-%Y'))}")
            print(f"  End Time:   {str(endTime.strftime('%m-%d-%Y'))}")
            print(f"  Time Extent: {str(timeDelta.days)} days")
        else:
            print("No time properties have been set on the layer")
    else:
        print("Time is not supported on this layer")&lt;/LI-CODE&gt;&lt;P&gt;My variables are event_start and event_end but whenever I insert them I get an error.&lt;/P&gt;&lt;LI-CODE lang="c"&gt;import arcpy
lyrFile = arcpy.mp.LayerFile(r'\\file\file.lyrx')
for lyr in lyrFile.listLayers():
    if lyr.supports('TIME'):
        if lyr.isTimeEnabled:
            lyrTime = lyr.time
            startTime = lyrTime.event_start
            endTime = lyrTime.event_end
            timeDelta = endTime - startTime&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 12 Sep 2023 12:57:17 GMT</pubDate>
    <dc:creator>Davec43</dc:creator>
    <dc:date>2023-09-12T12:57:17Z</dc:date>
    <item>
      <title>ARCPY and lyrtime</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcpy-and-lyrtime/m-p/1327675#M72951</link>
      <description>&lt;P&gt;I do not understand where to insert my variables.&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;import arcpy
lyrFile = arcpy.mp.LayerFile(r'C:\Projects\Time\ShipPositions.lyrx')
for lyr in lyrFile.listLayers():
    if lyr.supports('TIME'):
        if lyr.isTimeEnabled:
            lyrTime = lyr.time
            startTime = lyrTime.startTime
            endTime = lyrTime.endTime
            timeDelta = endTime - startTime
            print(f"Layer: {lyr.name}")
            print(f"  Start Time: {str(startTime.strftime('%m-%d-%Y'))}")
            print(f"  End Time:   {str(endTime.strftime('%m-%d-%Y'))}")
            print(f"  Time Extent: {str(timeDelta.days)} days")
        else:
            print("No time properties have been set on the layer")
    else:
        print("Time is not supported on this layer")&lt;/LI-CODE&gt;&lt;P&gt;My variables are event_start and event_end but whenever I insert them I get an error.&lt;/P&gt;&lt;LI-CODE lang="c"&gt;import arcpy
lyrFile = arcpy.mp.LayerFile(r'\\file\file.lyrx')
for lyr in lyrFile.listLayers():
    if lyr.supports('TIME'):
        if lyr.isTimeEnabled:
            lyrTime = lyr.time
            startTime = lyrTime.event_start
            endTime = lyrTime.event_end
            timeDelta = endTime - startTime&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Sep 2023 12:57:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcpy-and-lyrtime/m-p/1327675#M72951</guid>
      <dc:creator>Davec43</dc:creator>
      <dc:date>2023-09-12T12:57:17Z</dc:date>
    </item>
  </channel>
</rss>

