<?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: Dynamic date for yesterday in Mapping Questions</title>
    <link>https://community.esri.com/t5/mapping-questions/dynamic-date-for-yesterday/m-p/251183#M2684</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks! I didn't know much about text elements, so I've learned something here too &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 14 Dec 2015 14:23:35 GMT</pubDate>
    <dc:creator>JonMorris2</dc:creator>
    <dc:date>2015-12-14T14:23:35Z</dc:date>
    <item>
      <title>Dynamic date for yesterday</title>
      <link>https://community.esri.com/t5/mapping-questions/dynamic-date-for-yesterday/m-p/251168#M2669</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am producing some maps and I want the date on the map to be yesterdays date, as the data on the map relates to yesterdays progress.&lt;/P&gt;&lt;P&gt;I can only find in the dynamic date help section how to show this with today's date, when I want today-1.&lt;/P&gt;&lt;P&gt;Any ideas?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Mark Pratt&lt;/P&gt;&lt;P&gt;Western Geco&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Dec 2015 06:10:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/mapping-questions/dynamic-date-for-yesterday/m-p/251168#M2669</guid>
      <dc:creator>MarkPratt</dc:creator>
      <dc:date>2015-12-10T06:10:25Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic date for yesterday</title>
      <link>https://community.esri.com/t5/mapping-questions/dynamic-date-for-yesterday/m-p/251169#M2670</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Short of editing the date prior to printing, there is no option as you have discovered, so editing prior to printing or using a text element&amp;nbsp; and editing it, seem to be the only option&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Dec 2015 06:59:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/mapping-questions/dynamic-date-for-yesterday/m-p/251169#M2670</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2015-12-10T06:59:08Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic date for yesterday</title>
      <link>https://community.esri.com/t5/mapping-questions/dynamic-date-for-yesterday/m-p/251170#M2671</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Getting yesterday's date is fairly straightforward using python - the &lt;A href="https://docs.python.org/2/library/datetime.html#timedelta-objects" rel="nofollow noopener noreferrer" target="_blank"&gt;datetime&lt;/A&gt; module has everything you need.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For example:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;from datetime import date, timedelta&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 

date.strftime(date.today() - timedelta(days=1), '%d/%m/%Y')&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The question is, can you set dynamic text using Arcpy? I'm not sure, but example 2 &lt;A href="http://desktop.arcgis.com/en/desktop/latest/analyze/arcpy-mapping/textelement-class.htm" rel="nofollow noopener noreferrer" target="_blank"&gt;here&lt;/A&gt; seems to sugggest that you can.&lt;/P&gt;&lt;P&gt;Example url: &lt;A class="unlinked" title="http://desktop.arcgis.com/en/desktop/latest/analyze/arcpy-mapping/textelement-class.htm" target="_blank"&gt;http://desktop.arcgis.com/en/desktop/latest/analyze/arcpy-mapping/textelement-class.htm&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 12:27:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/mapping-questions/dynamic-date-for-yesterday/m-p/251170#M2671</guid>
      <dc:creator>JonMorris2</dc:creator>
      <dc:date>2021-12-11T12:27:36Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic date for yesterday</title>
      <link>https://community.esri.com/t5/mapping-questions/dynamic-date-for-yesterday/m-p/251171#M2672</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;John&lt;/P&gt;&lt;P&gt;The link to your example doesn't seem to work for me.&lt;/P&gt;&lt;P&gt;It gives me an unexpected error!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Mark&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Dec 2015 13:21:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/mapping-questions/dynamic-date-for-yesterday/m-p/251171#M2672</guid>
      <dc:creator>MarkPratt</dc:creator>
      <dc:date>2015-12-10T13:21:50Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic date for yesterday</title>
      <link>https://community.esri.com/t5/mapping-questions/dynamic-date-for-yesterday/m-p/251172#M2673</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That's weird - Geonet seems to be doing something bad to the link. I tried editing my post but it still didn't work. Try copying the text and pasting it into a new tab.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Dec 2015 14:03:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/mapping-questions/dynamic-date-for-yesterday/m-p/251172#M2673</guid>
      <dc:creator>JonMorris2</dc:creator>
      <dc:date>2015-12-10T14:03:05Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic date for yesterday</title>
      <link>https://community.esri.com/t5/mapping-questions/dynamic-date-for-yesterday/m-p/251173#M2674</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It is a link to dynamic text, which is what I was suggesting.&amp;nbsp; If you go into advanced editor, then select the html from the edit line, you can copy and paste the link into your browser.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Dec 2015 14:09:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/mapping-questions/dynamic-date-for-yesterday/m-p/251173#M2674</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2015-12-10T14:09:14Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic date for yesterday</title>
      <link>https://community.esri.com/t5/mapping-questions/dynamic-date-for-yesterday/m-p/251174#M2675</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Jon&lt;/P&gt;&lt;P&gt;I have got to the link eventually, but I'm not familiar with Arcpy.&lt;/P&gt;&lt;P&gt;So how would I implement this?&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Mark&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 Dec 2015 08:32:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/mapping-questions/dynamic-date-for-yesterday/m-p/251174#M2675</guid>
      <dc:creator>MarkPratt</dc:creator>
      <dc:date>2015-12-11T08:32:17Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic date for yesterday</title>
      <link>https://community.esri.com/t5/mapping-questions/dynamic-date-for-yesterday/m-p/251175#M2676</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Create a text element in your layout with the "Element Name" = DateTimeElm&lt;/P&gt;&lt;P&gt;Then open python inside arcpmap by clicking on the python tool on your standard tools tool bar. Copy and paste the code below into the python interpreter and click enter twice.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;code&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;from datetime import date, timedelta 
mxd = arcpy.mapping.MapDocument("CURRENT")
#Where my code says "DateTimeElm" your text element needs to be named the same or change this name to reflect your text element
elm = arcpy.mapping.ListLayoutElements(mxd, "TEXT_ELEMENT", "DateTimeElm")[0]
elm.text = date.strftime(date.today() - timedelta(days=1), '%m/%d/%Y')
arcpy.RefreshActiveView()
&lt;/PRE&gt;&lt;P&gt;&lt;IMG class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/154945_pastedImage_1.png" style="max-width: 1200px; max-height: 900px;" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 12:27:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/mapping-questions/dynamic-date-for-yesterday/m-p/251175#M2676</guid>
      <dc:creator>WesMiller</dc:creator>
      <dc:date>2021-12-11T12:27:39Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic date for yesterday</title>
      <link>https://community.esri.com/t5/mapping-questions/dynamic-date-for-yesterday/m-p/251176#M2677</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Wes,&lt;/P&gt;&lt;P&gt;This is great, but is this really any quicker than changing the date in the text element manually each time?&lt;/P&gt;&lt;P&gt;Is there a way of applying this code automatically whenever I open my maps, or can a script be written to update the date on all the maps (5) that I produce on a daily basis, in one operation before opening them?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 12 Dec 2015 07:34:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/mapping-questions/dynamic-date-for-yesterday/m-p/251176#M2677</guid>
      <dc:creator>MarkPratt</dc:creator>
      <dc:date>2015-12-12T07:34:19Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic date for yesterday</title>
      <link>https://community.esri.com/t5/mapping-questions/dynamic-date-for-yesterday/m-p/251177#M2678</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Save the code as a python script example "somemeaningfulName.py" then follow these instructions &lt;A href="http://desktop.arcgis.com/en/desktop/latest/analyze/creating-tools/adding-a-script-tool.htm" title="http://desktop.arcgis.com/en/desktop/latest/analyze/creating-tools/adding-a-script-tool.htm"&gt;Adding a script tool—Help | ArcGIS for Desktop&lt;/A&gt; it will only work if you have the correctly named text element in your layout.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 12 Dec 2015 15:23:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/mapping-questions/dynamic-date-for-yesterday/m-p/251177#M2678</guid>
      <dc:creator>WesMiller</dc:creator>
      <dc:date>2015-12-12T15:23:14Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic date for yesterday</title>
      <link>https://community.esri.com/t5/mapping-questions/dynamic-date-for-yesterday/m-p/251178#M2679</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Are you using data driven pages? If you are then you can use Wes Miller's code in a display expression for your data driven page layer like so:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;def FindLabel ( ):
&amp;nbsp;&amp;nbsp;&amp;nbsp; from datetime import date, timedelta
&amp;nbsp;&amp;nbsp;&amp;nbsp; return date.strftime(date.today() - timedelta(days=1), '%m/%d/%Y')&lt;/PRE&gt;&lt;P&gt;&lt;IMG class="image-2 jive-image" src="https://community.esri.com/legacyfs/online/156004_pastedImage_6.png" style="max-width: 1200px; max-height: 900px;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then in your dynamic text element you would use this:&lt;/P&gt;&lt;P&gt;&amp;lt;dyn type="page" property="expression" /&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/156003_pastedImage_5.png" style="max-width: 1200px; max-height: 900px;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This works for me and should update automatically for all your maps since it uses the current date code.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 12:27:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/mapping-questions/dynamic-date-for-yesterday/m-p/251178#M2679</guid>
      <dc:creator>LukeSturtevant</dc:creator>
      <dc:date>2021-12-11T12:27:42Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic date for yesterday</title>
      <link>https://community.esri.com/t5/mapping-questions/dynamic-date-for-yesterday/m-p/251179#M2680</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Luke&lt;/P&gt;&lt;P&gt;Sad to say that they are not data driven pages but separate MXD files.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 14 Dec 2015 14:03:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/mapping-questions/dynamic-date-for-yesterday/m-p/251179#M2680</guid>
      <dc:creator>MarkPratt</dc:creator>
      <dc:date>2015-12-14T14:03:40Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic date for yesterday</title>
      <link>https://community.esri.com/t5/mapping-questions/dynamic-date-for-yesterday/m-p/251180#M2681</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Luke, the code was from Jon Morris&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 14 Dec 2015 14:16:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/mapping-questions/dynamic-date-for-yesterday/m-p/251180#M2681</guid>
      <dc:creator>WesMiller</dc:creator>
      <dc:date>2015-12-14T14:16:08Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic date for yesterday</title>
      <link>https://community.esri.com/t5/mapping-questions/dynamic-date-for-yesterday/m-p/251181#M2682</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Well you could still set up data drive pages especially if your maps are all consistent and using an index polygon layer for paneling such as a town boundary polygon. You could also set up a &lt;A href="http://pro.arcgis.com/en/pro-app/tool-reference/data-management/create-fishnet.htm"&gt;fishnet&lt;/A&gt;​ of your map area to create a panel scheme. But if you already have it up and running with the text element and python script tool you might as well stick with that.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 14 Dec 2015 14:18:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/mapping-questions/dynamic-date-for-yesterday/m-p/251181#M2682</guid>
      <dc:creator>LukeSturtevant</dc:creator>
      <dc:date>2015-12-14T14:18:58Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic date for yesterday</title>
      <link>https://community.esri.com/t5/mapping-questions/dynamic-date-for-yesterday/m-p/251182#M2683</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Oops thanks for the correction Wes. Indeed, credit goes to Jon Morris for the code.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 14 Dec 2015 14:20:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/mapping-questions/dynamic-date-for-yesterday/m-p/251182#M2683</guid>
      <dc:creator>LukeSturtevant</dc:creator>
      <dc:date>2015-12-14T14:20:32Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic date for yesterday</title>
      <link>https://community.esri.com/t5/mapping-questions/dynamic-date-for-yesterday/m-p/251183#M2684</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks! I didn't know much about text elements, so I've learned something here too &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 14 Dec 2015 14:23:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/mapping-questions/dynamic-date-for-yesterday/m-p/251183#M2684</guid>
      <dc:creator>JonMorris2</dc:creator>
      <dc:date>2015-12-14T14:23:35Z</dc:date>
    </item>
  </channel>
</rss>

