<?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 Convert date to string in ArcGIS API for Python Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-python-questions/convert-date-to-string/m-p/829761#M3113</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I created a query to pull the current weeks Monday but can't figure out how to convert that to a string and create a variable that prints it in this format ('%Y/%m/%d')&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;import datetime
today = datetime.date.today()
today + datetime.timedelta(days=-today.weekday())

&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 12 Dec 2021 10:01:01 GMT</pubDate>
    <dc:creator>Anonymous User</dc:creator>
    <dc:date>2021-12-12T10:01:01Z</dc:date>
    <item>
      <title>Convert date to string</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/convert-date-to-string/m-p/829761#M3113</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I created a query to pull the current weeks Monday but can't figure out how to convert that to a string and create a variable that prints it in this format ('%Y/%m/%d')&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;import datetime
today = datetime.date.today()
today + datetime.timedelta(days=-today.weekday())

&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 10:01:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/convert-date-to-string/m-p/829761#M3113</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2021-12-12T10:01:01Z</dc:date>
    </item>
    <item>
      <title>Re: Convert date to string</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/convert-date-to-string/m-p/829762#M3114</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;mon &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; today &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; datetime&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;timedelta&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;days&lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;-&lt;/SPAN&gt;today&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;weekday&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt; mon&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;strftime&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"%Y/%m/%d"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;‍‍‍‍‍‍‍‍‍‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 10:01:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/convert-date-to-string/m-p/829762#M3114</guid>
      <dc:creator>RandyBurton</dc:creator>
      <dc:date>2021-12-12T10:01:03Z</dc:date>
    </item>
    <item>
      <title>Re: Convert date to string</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/convert-date-to-string/m-p/829763#M3115</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;for python 3 don't forget print is different&lt;/P&gt;&lt;PRE class="language-python line-numbers"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;mon&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;strftime&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"%Y/%m/%d"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Sep 2018 22:52:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/convert-date-to-string/m-p/829763#M3115</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2018-09-12T22:52:34Z</dc:date>
    </item>
    <item>
      <title>Re: Convert date to string</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/convert-date-to-string/m-p/829764#M3116</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Don't forget that .weekday() for Sunday = 6, so the Monday for Sunday 2018/09/09 is 2018/09/03 and not the following day (the 10th).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Sep 2018 23:32:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/convert-date-to-string/m-p/829764#M3116</guid>
      <dc:creator>RandyBurton</dc:creator>
      <dc:date>2018-09-12T23:32:07Z</dc:date>
    </item>
  </channel>
</rss>

