<?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 Inserting Current Date into Filename via Modelbuilder in Geoprocessing Questions</title>
    <link>https://community.esri.com/t5/geoprocessing-questions/inserting-current-date-into-filename-via/m-p/9828#M356</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Is there a way to programmatically export a shapefile or feature class from Modelbuilder that has the current date in its filename?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 04 Feb 2011 13:46:43 GMT</pubDate>
    <dc:creator>JeffPickles</dc:creator>
    <dc:date>2011-02-04T13:46:43Z</dc:date>
    <item>
      <title>Inserting Current Date into Filename via Modelbuilder</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/inserting-current-date-into-filename-via/m-p/9828#M356</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Is there a way to programmatically export a shapefile or feature class from Modelbuilder that has the current date in its filename?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 04 Feb 2011 13:46:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/inserting-current-date-into-filename-via/m-p/9828#M356</guid>
      <dc:creator>JeffPickles</dc:creator>
      <dc:date>2011-02-04T13:46:43Z</dc:date>
    </item>
    <item>
      <title>Re: Inserting Current Date into Filename via Modelbuilder</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/inserting-current-date-into-filename-via/m-p/9829#M357</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Jeff,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm assuming you're on 10.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Check the toolbox I've attached. You dont need to script this.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;You'll see its just a copy features and a Calc Value.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The Calc value has a python snippet to calc the date. The output of this is "outDate"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I've then used the inline variable %outDate% as the name of the featureclass.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I grabbed the snippet from:&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/Calculate_Field_examples/00170000004s000000/"&gt;http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/Calculate_Field_examples/00170000004s000000/&lt;/A&gt;&lt;BR /&gt;&lt;SPAN&gt;Depending on how you write out&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;time.strftime("%d/%m/%Y")&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt;(d/MM/yyyy etc etc), you can get different dates. Also remember the featureclass name cant start with a number.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 04 Feb 2011 15:25:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/inserting-current-date-into-filename-via/m-p/9829#M357</guid>
      <dc:creator>KevinHibma</dc:creator>
      <dc:date>2011-02-04T15:25:50Z</dc:date>
    </item>
    <item>
      <title>Re: Inserting Current Date into Filename via Modelbuilder</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/inserting-current-date-into-filename-via/m-p/9830#M358</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I was googling how to do something similar and this little discussion eventually lead me to my solution.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It can be done by placing a &lt;A href="http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//004000000004000000.htm"&gt;Calculate Value Tool&lt;/A&gt; in your model and setting its expression to:&lt;/P&gt;&lt;P&gt;time.strftime("%Y%m%d")&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The output value will be a date or time in the format you specify between the "s. This link has a nice table with helpful explanations about the different date and time formatting options and possible associated limitations or restrictions: &lt;A href="https://docs.python.org/2/library/datetime.html#strftime-strptime-behavior" title="https://docs.python.org/2/library/datetime.html#strftime-strptime-behavior"&gt;8.1. datetime - Basic date and time types - Python v2.7.8 documentation&lt;/A&gt;‌.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My example has the particular format(%Y%m%d) such that if the model were run on June 8, 2001, the output value from the tool would be the string '20010608'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can then rename the output value(green bubble) to ANYTHING and then elsewhere in your model you can reference that value by inserting %ANYTHING% into filenames or location dialogues throughout the rest of the model, just like &lt;A href="http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//002w00000060000000"&gt;other in-line variables&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope this helps you out, 3&lt;SPAN style="color: #545454; font-family: arial, sans-serif; font-size: small;"&gt;½&lt;/SPAN&gt; years late, or more likely, somebody else with the same question.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 17 Jul 2014 14:54:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/inserting-current-date-into-filename-via/m-p/9830#M358</guid>
      <dc:creator>RyanStillman</dc:creator>
      <dc:date>2014-07-17T14:54:24Z</dc:date>
    </item>
    <item>
      <title>Re: Inserting Current Date into Filename via Modelbuilder</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/inserting-current-date-into-filename-via/m-p/9831#M359</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for posting &lt;A href="https://community.esri.com/migrated-users/43028"&gt;Ryan Stillman&lt;/A&gt;‌ - your late reply helped me figure this out!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 05 Dec 2014 19:14:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/inserting-current-date-into-filename-via/m-p/9831#M359</guid>
      <dc:creator>SaraBarnes</dc:creator>
      <dc:date>2014-12-05T19:14:25Z</dc:date>
    </item>
    <item>
      <title>Re: Inserting Current Date into Filename via Modelbuilder</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/inserting-current-date-into-filename-via/m-p/9832#M360</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you for posting this - it worked perfectly.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 02 Oct 2015 17:42:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/inserting-current-date-into-filename-via/m-p/9832#M360</guid>
      <dc:creator>JulieScott-Ashe1</dc:creator>
      <dc:date>2015-10-02T17:42:11Z</dc:date>
    </item>
    <item>
      <title>Re: Inserting Current Date into Filename via Modelbuilder</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/inserting-current-date-into-filename-via/m-p/9833#M361</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Helped me too, thanks for posting!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 May 2016 23:51:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/inserting-current-date-into-filename-via/m-p/9833#M361</guid>
      <dc:creator>JasonHrubizna</dc:creator>
      <dc:date>2016-05-24T23:51:56Z</dc:date>
    </item>
    <item>
      <title>Re: Inserting Current Date into Filename via Modelbuilder</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/inserting-current-date-into-filename-via/m-p/9834#M362</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The Calculate Value tool really makes &lt;A href="https://community.esri.com/group/1218"&gt;Model Builder&lt;/A&gt;​ a lot more useful -- and a little Python knowledge goes a long way with that thing!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 May 2016 00:40:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/inserting-current-date-into-filename-via/m-p/9834#M362</guid>
      <dc:creator>curtvprice</dc:creator>
      <dc:date>2016-05-25T00:40:18Z</dc:date>
    </item>
    <item>
      <title>Re: Inserting Current Date into Filename via Modelbuilder</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/inserting-current-date-into-filename-via/m-p/9835#M363</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Works great! Thanks for the post.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Feb 2017 21:55:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/inserting-current-date-into-filename-via/m-p/9835#M363</guid>
      <dc:creator>NedCake1</dc:creator>
      <dc:date>2017-02-09T21:55:49Z</dc:date>
    </item>
    <item>
      <title>Re: Inserting Current Date into Filename via Modelbuilder</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/inserting-current-date-into-filename-via/m-p/9836#M364</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Odd, the example doesn't seem to work for me. I'm running 10.3.1. If I run in a python script it works fine but not so much in Model Builder where the variable is assigned a "1". Any suggestions?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 10 Apr 2017 15:54:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/inserting-current-date-into-filename-via/m-p/9836#M364</guid>
      <dc:creator>WilliamJackson4</dc:creator>
      <dc:date>2017-04-10T15:54:53Z</dc:date>
    </item>
    <item>
      <title>Re: Inserting Current Date into Filename via Modelbuilder</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/inserting-current-date-into-filename-via/m-p/9837#M365</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;William, I was having the same issue but then I connected the output date (green bubble)&amp;nbsp;as a precondition variable to the tools (yellow bubble) that I ran and it worked for me!&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/346474_pastedImage_1.png" style="width: auto; height: auto;" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 13 Apr 2017 14:55:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/inserting-current-date-into-filename-via/m-p/9837#M365</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2017-04-13T14:55:11Z</dc:date>
    </item>
    <item>
      <title>Re: Inserting Current Date into Filename via Modelbuilder</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/inserting-current-date-into-filename-via/m-p/9838#M366</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you!!&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 28 Jul 2017 23:28:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/inserting-current-date-into-filename-via/m-p/9838#M366</guid>
      <dc:creator>DianaHutt</dc:creator>
      <dc:date>2017-07-28T23:28:34Z</dc:date>
    </item>
    <item>
      <title>Re: Inserting Current Date into Filename via Modelbuilder</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/inserting-current-date-into-filename-via/m-p/9839#M367</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I seem to be having similar issues. I was getting the "1" output but now I get the date but also keep getting errors about incorrect naming. Can anyone tell me what name is wrong? The original demo tool provided further up has the same issue!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-3 jive-image" src="https://community.esri.com/legacyfs/online/382656_pastedImage_5.png" style="width: 620px; height: 671px;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-2 jive-image" src="https://community.esri.com/legacyfs/online/382655_pastedImage_4.png" style="width: 620px; height: 535px;" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Nov 2017 03:57:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/inserting-current-date-into-filename-via/m-p/9839#M367</guid>
      <dc:creator>LindsayRaabe_FPCWA</dc:creator>
      <dc:date>2017-11-06T03:57:29Z</dc:date>
    </item>
    <item>
      <title>Re: Inserting Current Date into Filename via Modelbuilder</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/inserting-current-date-into-filename-via/m-p/9840#M368</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I answered here&amp;nbsp;&lt;A href="https://community.esri.com/thread/204767-why-wont-my-date-variable-work"&gt;https://community.esri.com/thread/204767-why-wont-my-date-variable-work&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Nov 2017 16:37:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/inserting-current-date-into-filename-via/m-p/9840#M368</guid>
      <dc:creator>curtvprice</dc:creator>
      <dc:date>2017-11-10T16:37:55Z</dc:date>
    </item>
    <item>
      <title>Re: Inserting Current Date into Filename via Modelbuilder</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/inserting-current-date-into-filename-via/m-p/9841#M369</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Worked for me also, thanks mate! &lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 28 Apr 2018 16:54:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/inserting-current-date-into-filename-via/m-p/9841#M369</guid>
      <dc:creator>AurelijaViluckyte</dc:creator>
      <dc:date>2018-04-28T16:54:08Z</dc:date>
    </item>
    <item>
      <title>Re: Inserting Current Date into Filename via Modelbuilder</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/inserting-current-date-into-filename-via/m-p/9842#M370</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Helped me too! Never too late.&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 29 Mar 2019 15:19:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/inserting-current-date-into-filename-via/m-p/9842#M370</guid>
      <dc:creator>ShariForbes</dc:creator>
      <dc:date>2019-03-29T15:19:01Z</dc:date>
    </item>
    <item>
      <title>Re: Inserting Current Date into Filename via Modelbuilder</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/inserting-current-date-into-filename-via/m-p/9843#M371</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;thanks so much - this worked great and really helped me&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 Apr 2019 13:21:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/inserting-current-date-into-filename-via/m-p/9843#M371</guid>
      <dc:creator>MichelleWalker</dc:creator>
      <dc:date>2019-04-25T13:21:35Z</dc:date>
    </item>
    <item>
      <title>Re: Inserting Current Date into Filename via Modelbuilder</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/inserting-current-date-into-filename-via/m-p/9844#M372</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Great, also see:&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.esri.com/message/858545"&gt;Formatting date as string from user input date value in ModelBuilder&lt;/A&gt;‌&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Jun 2019 22:21:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/inserting-current-date-into-filename-via/m-p/9844#M372</guid>
      <dc:creator>curtvprice</dc:creator>
      <dc:date>2019-06-19T22:21:00Z</dc:date>
    </item>
    <item>
      <title>Re: Inserting Current Date into Filename via Modelbuilder</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/inserting-current-date-into-filename-via/m-p/1277098#M26814</link>
      <description>&lt;P&gt;Almost a decade after you posted, and your answer still works - even in ArcGIS Pro! The (possible?) difference from ArcMap is you access Calculate Value in Pro via its own item in the ModelBuilder ribbon under Utilities and set the data type as string.&lt;/P&gt;&lt;P&gt;I hope this helps other ArcGIS Pro folks who surf here as this thread was the top search engine result.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Apr 2023 21:37:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/inserting-current-date-into-filename-via/m-p/1277098#M26814</guid>
      <dc:creator>DanSadler1</dc:creator>
      <dc:date>2023-04-10T21:37:33Z</dc:date>
    </item>
  </channel>
</rss>

