<?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 Re: Model Iterator for Date Ranges? in Geoprocessing Questions</title>
    <link>https://community.esri.com/t5/geoprocessing-questions/model-iterator-for-date-ranges/m-p/157632#M5286</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Excellent. Worked like a charm. Thanks much!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Dumb question: &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;How do I alter this to use today's date as end?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Like so?: &lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;# Fun stuff
start = datetime.datetime.strptime(start,"%m/%d/%Y")
end = time.strftime(end,"%m/%d/%Y")

&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 08:20:59 GMT</pubDate>
    <dc:creator>JeffPickles</dc:creator>
    <dc:date>2021-12-11T08:20:59Z</dc:date>
    <item>
      <title>Model Iterator for Date Ranges?</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/model-iterator-for-date-ranges/m-p/157628#M5282</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Is there a way to programmatically go through a range of dates, select features that were present on each date, and create a shapefile with each date's features? &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have a single shapefile with a [START_DATE] and an [END_DATE] field, both formatted as Date fields. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm looking for a way to go through a series of dates (say, January 1 through today) and create a series of daily snapshots that will show which features were present on those dates. The kicker is that I need this to be done in a geoprocessing environment because I'd then like to turn around and create Directional Distribution polygons for each date (otherwise I could just turn on the Time Slider and be satisfied with the original SHP).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm trying to do this in Modelbuilder, but the available Iterators don't seem to include date range functionality. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Ideas?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Apr 2011 19:11:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/model-iterator-for-date-ranges/m-p/157628#M5282</guid>
      <dc:creator>JeffPickles</dc:creator>
      <dc:date>2011-04-07T19:11:19Z</dc:date>
    </item>
    <item>
      <title>Re: Model Iterator for Date Ranges?</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/model-iterator-for-date-ranges/m-p/157629#M5283</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Do you want one shapefile for each date in the range?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Apr 2011 19:37:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/model-iterator-for-date-ranges/m-p/157629#M5283</guid>
      <dc:creator>DarrenWiens2</dc:creator>
      <dc:date>2011-04-07T19:37:15Z</dc:date>
    </item>
    <item>
      <title>Re: Model Iterator for Date Ranges?</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/model-iterator-for-date-ranges/m-p/157630#M5284</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;For this step in the process, yes. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;For a final product, not necessarily. After I run the Directional Distribution for each date's SHP, I plan on appending the results into a single directional distribution SHP with a date field. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So maybe the best way of explaining it would be that I'm looking to run Directional Distribution for each date within a date range. One source point shapefile with start and end dates, one result polygon shapefile with a date field.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Apr 2011 20:51:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/model-iterator-for-date-ranges/m-p/157630#M5284</guid>
      <dc:creator>JeffPickles</dc:creator>
      <dc:date>2011-04-07T20:51:53Z</dc:date>
    </item>
    <item>
      <title>Re: Model Iterator for Date Ranges?</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/model-iterator-for-date-ranges/m-p/157631#M5285</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;The following python script will take an input feature class ("input"), compare each row with the dates between specified start ("start") and end ("end") dates, and output shapefiles into a folder ("outfolder").&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
# Import arcpy module
import arcpy, datetime

# Script arguments
input = arcpy.GetParameterAsText(0)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # feature class with date data
outfolder = arcpy.GetParameterAsText(1) # folder for your shapefiles
start = arcpy.GetParameterAsText(2)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # first date in date range
end = arcpy.GetParameterAsText(3)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # last date in date range

# Fun stuff
start = datetime.datetime.strptime(start,"%m/%d/%Y")
end = datetime.datetime.strptime(end,"%m/%d/%Y")

curdate = start

while curdate &amp;lt; end:
&amp;nbsp;&amp;nbsp;&amp;nbsp; curdate = curdate + datetime.timedelta(days=1)
&amp;nbsp;&amp;nbsp;&amp;nbsp; where_clause = "\"Start_Date\" &amp;lt; date '" + curdate.strftime("%m/%d/%Y") + "' and \"End_Date\" &amp;gt; date '" + curdate.strftime("%m/%d/%Y") + "'"
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddMessage(where_clause)
&amp;nbsp;&amp;nbsp;&amp;nbsp; opfile = outfolder + "/" + curdate.strftime("%m%d%Y") + ".shp"
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.Select_analysis(input, opfile, where_clause)&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 08:20:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/model-iterator-for-date-ranges/m-p/157631#M5285</guid>
      <dc:creator>DarrenWiens2</dc:creator>
      <dc:date>2021-12-11T08:20:56Z</dc:date>
    </item>
    <item>
      <title>Re: Model Iterator for Date Ranges?</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/model-iterator-for-date-ranges/m-p/157632#M5286</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Excellent. Worked like a charm. Thanks much!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Dumb question: &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;How do I alter this to use today's date as end?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Like so?: &lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;# Fun stuff
start = datetime.datetime.strptime(start,"%m/%d/%Y")
end = time.strftime(end,"%m/%d/%Y")

&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 08:20:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/model-iterator-for-date-ranges/m-p/157632#M5286</guid>
      <dc:creator>JeffPickles</dc:creator>
      <dc:date>2021-12-11T08:20:59Z</dc:date>
    </item>
    <item>
      <title>Re: Model Iterator for Date Ranges?</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/model-iterator-for-date-ranges/m-p/157633#M5287</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Cool. Change it to:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;end = datetime.today()&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;...or possibly datetime.datetime.today()&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Apr 2011 22:22:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/model-iterator-for-date-ranges/m-p/157633#M5287</guid>
      <dc:creator>DarrenWiens2</dc:creator>
      <dc:date>2011-04-07T22:22:21Z</dc:date>
    </item>
    <item>
      <title>Re: Model Iterator for Date Ranges?</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/model-iterator-for-date-ranges/m-p/157634#M5288</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;After sleeping on it, it would be better to have all of the dates in one shapefile, after all. I didn't realize the Directional Distribution tool can run seperate incarnations based on a single field. So if there were a way to put all of the individual dates into one shapefile, that would be ideal. Sorry for the run-around.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 08 Apr 2011 16:25:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/model-iterator-for-date-ranges/m-p/157634#M5288</guid>
      <dc:creator>JeffPickles</dc:creator>
      <dc:date>2011-04-08T16:25:38Z</dc:date>
    </item>
  </channel>
</rss>

