<?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: Python Date Stamping in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/python-date-stamping/m-p/745128#M57594</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes, that is basically what I am trying to do, I will give that a try and let you know how it goes.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your quick responses,&lt;/P&gt;&lt;P&gt;Steve&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 20 Oct 2014 15:39:39 GMT</pubDate>
    <dc:creator>StephenEldridge</dc:creator>
    <dc:date>2014-10-20T15:39:39Z</dc:date>
    <item>
      <title>Python Date Stamping</title>
      <link>https://community.esri.com/t5/python-questions/python-date-stamping/m-p/745124#M57590</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;BR /&gt;&lt;SPAN style="font-family: arial,helvetica,sans-serif; font-size: 12pt;"&gt;Anyone know how to make python put a date stamp on a filename when creating a feature?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial,helvetica,sans-serif; font-size: 12pt;"&gt;Thanks,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial,helvetica,sans-serif; font-size: 12pt;"&gt;Steve&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Oct 2014 15:03:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-date-stamping/m-p/745124#M57590</guid>
      <dc:creator>StephenEldridge</dc:creator>
      <dc:date>2014-10-20T15:03:34Z</dc:date>
    </item>
    <item>
      <title>Re: Python Date Stamping</title>
      <link>https://community.esri.com/t5/python-questions/python-date-stamping/m-p/745125#M57591</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Steve,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can you clarify your question a little?&amp;nbsp; Are you looking to put a date stamp on a new feature class?&amp;nbsp; I've written a few scripts that utilize dates and times and the method changes a little based on where you want to put the data.&amp;nbsp; Let me know and I can try to help.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Thanks,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Brandon&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Oct 2014 15:15:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-date-stamping/m-p/745125#M57591</guid>
      <dc:creator>BrandonKeinath1</dc:creator>
      <dc:date>2014-10-20T15:15:15Z</dc:date>
    </item>
    <item>
      <title>Re: Python Date Stamping</title>
      <link>https://community.esri.com/t5/python-questions/python-date-stamping/m-p/745126#M57592</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;BR /&gt;Hi Brandon,&lt;/P&gt;&lt;P&gt;Yes on a new feature class.&amp;nbsp; I am running a feature to feature script that filters specific data for each feature and I need to date stamp them so that I can view changes in a side by side comparison and the output goes into a File Geodatabase.&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Steve&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Oct 2014 15:21:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-date-stamping/m-p/745126#M57592</guid>
      <dc:creator>StephenEldridge</dc:creator>
      <dc:date>2014-10-20T15:21:41Z</dc:date>
    </item>
    <item>
      <title>Re: Python Date Stamping</title>
      <link>https://community.esri.com/t5/python-questions/python-date-stamping/m-p/745127#M57593</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;And you would like the date stamp to be on the feature class?&amp;nbsp; So you could check today's "River" export against yesterday's "River" feature class?&amp;nbsp; If I'm understanding you right then I would suggest importing datetime.&amp;nbsp; Depending on how you want to format the date you have some options shown here &lt;A href="https://docs.python.org/2/library/datetime.html" title="https://docs.python.org/2/library/datetime.html"&gt;8.1. datetime — Basic date and time types — Python 2.7.8 documentation&lt;/A&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;import datetime&lt;/P&gt;&lt;P&gt;#Set a variable to hold today's date&lt;/P&gt;&lt;P&gt;currentdate = datetime.date.today()&lt;/P&gt;&lt;P&gt;#Execute the feature to feature function.&amp;nbsp; Casting as a string just to be safe&lt;/P&gt;&lt;P&gt;arcpy.FeatureClassToFeatureClass_conversion(in_features, out_path, out_name + str(currentdate))&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Oct 2014 15:33:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-date-stamping/m-p/745127#M57593</guid>
      <dc:creator>BrandonKeinath1</dc:creator>
      <dc:date>2014-10-20T15:33:11Z</dc:date>
    </item>
    <item>
      <title>Re: Python Date Stamping</title>
      <link>https://community.esri.com/t5/python-questions/python-date-stamping/m-p/745128#M57594</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes, that is basically what I am trying to do, I will give that a try and let you know how it goes.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your quick responses,&lt;/P&gt;&lt;P&gt;Steve&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Oct 2014 15:39:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-date-stamping/m-p/745128#M57594</guid>
      <dc:creator>StephenEldridge</dc:creator>
      <dc:date>2014-10-20T15:39:39Z</dc:date>
    </item>
    <item>
      <title>Re: Python Date Stamping</title>
      <link>https://community.esri.com/t5/python-questions/python-date-stamping/m-p/745129#M57595</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You're welcome and good luck.&amp;nbsp; If it gives you trouble let me know and I can try to help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Brandon&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Oct 2014 15:42:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-date-stamping/m-p/745129#M57595</guid>
      <dc:creator>BrandonKeinath1</dc:creator>
      <dc:date>2014-10-20T15:42:18Z</dc:date>
    </item>
    <item>
      <title>Re: Python Date Stamping</title>
      <link>https://community.esri.com/t5/python-questions/python-date-stamping/m-p/745130#M57596</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Oct 2014 15:45:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-date-stamping/m-p/745130#M57596</guid>
      <dc:creator>StephenEldridge</dc:creator>
      <dc:date>2014-10-20T15:45:21Z</dc:date>
    </item>
    <item>
      <title>Re: Python Date Stamping</title>
      <link>https://community.esri.com/t5/python-questions/python-date-stamping/m-p/745131#M57597</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Good morning Brandon,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I figured out how to send the string to the feature output but the format is 2014-10-23 and I need it to be 20141023.  I have read through documentation and have not been able to figure out how to do this format could you please assist?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Steve&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Oct 2014 14:36:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-date-stamping/m-p/745131#M57597</guid>
      <dc:creator>StephenEldridge</dc:creator>
      <dc:date>2014-10-23T14:36:18Z</dc:date>
    </item>
    <item>
      <title>Re: Python Date Stamping</title>
      <link>https://community.esri.com/t5/python-questions/python-date-stamping/m-p/745132#M57598</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Happy to,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm not sure how you ended up coding it but you can modify your date object with .strftime which lets you tell the date objects how to orient themselves.&amp;nbsp; There is a really good reply on stack overflow &lt;A href="http://stackoverflow.com/questions/311627/how-to-print-date-in-a-regular-format-in-python" title="http://stackoverflow.com/questions/311627/how-to-print-date-in-a-regular-format-in-python"&gt;datetime - How to print date in a regular format in Python? - Stack Overflow&lt;/A&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But in your case I would say code like currentdate.strftime(%Y%b%d) should format it the way you want.&amp;nbsp; You can reference the formatting letters in either the link or the help for strftime.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Good luck,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Brandon&lt;/P&gt;&lt;P&gt;&lt;CODE&gt;&lt;SPAN class="kwd"&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Oct 2014 14:52:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-date-stamping/m-p/745132#M57598</guid>
      <dc:creator>BrandonKeinath1</dc:creator>
      <dc:date>2014-10-23T14:52:39Z</dc:date>
    </item>
    <item>
      <title>Re: Python Date Stamping</title>
      <link>https://community.esri.com/t5/python-questions/python-date-stamping/m-p/745133#M57599</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Here is how I had to code it:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;import time&lt;/P&gt;&lt;P&gt;from datetime import Date&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;#Sets a variable to hold today's date&lt;/P&gt;&lt;P&gt;currentdate = today()&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;OL&gt;&lt;LI level="1" type="ol"&gt;&lt;P&gt;Process: Feature Class to Feature Class (6)&lt;/P&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;arcpy.FeatureClassToFeatureClass_conversion(in, out loc, "output_"+str(currentdate)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The result is: output_2014-10-23&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The “-“ causes failure as an invalid character&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Oct 2014 15:08:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-date-stamping/m-p/745133#M57599</guid>
      <dc:creator>StephenEldridge</dc:creator>
      <dc:date>2014-10-23T15:08:44Z</dc:date>
    </item>
    <item>
      <title>Re: Python Date Stamping</title>
      <link>https://community.esri.com/t5/python-questions/python-date-stamping/m-p/745134#M57600</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Understood.&amp;nbsp; Try this&lt;/P&gt;&lt;P&gt;import datetime&lt;/P&gt;&lt;P&gt;currentdate = datetime.date.today()&lt;/P&gt;&lt;P&gt;nohyphendate = currentdate.strftime(%Y%m%d)&lt;/P&gt;&lt;P&gt;print "output_" + nohyphendate&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I had an error in my previous reply.&amp;nbsp; If you use a %b you get the month abbreviation.&amp;nbsp; %m gets you the integer of the month.&amp;nbsp; Does that fix your error?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Brandon&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Oct 2014 15:28:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-date-stamping/m-p/745134#M57600</guid>
      <dc:creator>BrandonKeinath1</dc:creator>
      <dc:date>2014-10-23T15:28:16Z</dc:date>
    </item>
    <item>
      <title>Re: Python Date Stamping</title>
      <link>https://community.esri.com/t5/python-questions/python-date-stamping/m-p/745135#M57601</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Figured it out.  Thanks for your help&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Oct 2014 15:30:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-date-stamping/m-p/745135#M57601</guid>
      <dc:creator>StephenEldridge</dc:creator>
      <dc:date>2014-10-23T15:30:20Z</dc:date>
    </item>
    <item>
      <title>Re: Python Date Stamping</title>
      <link>https://community.esri.com/t5/python-questions/python-date-stamping/m-p/745136#M57602</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Here is what I used and it worked:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Import datetime&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;currentdate = datetime.date.today().strftime("%Y""%m""%d")&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks again,&lt;/P&gt;&lt;P&gt;Steve&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Oct 2014 15:36:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-date-stamping/m-p/745136#M57602</guid>
      <dc:creator>StephenEldridge</dc:creator>
      <dc:date>2014-10-23T15:36:20Z</dc:date>
    </item>
    <item>
      <title>Re: Python Date Stamping</title>
      <link>https://community.esri.com/t5/python-questions/python-date-stamping/m-p/745137#M57603</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You're welcome.&amp;nbsp; Glad you were able to make it work.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Oct 2014 15:41:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-date-stamping/m-p/745137#M57603</guid>
      <dc:creator>BrandonKeinath1</dc:creator>
      <dc:date>2014-10-23T15:41:53Z</dc:date>
    </item>
  </channel>
</rss>

