<?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: Proper coding with date formats in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/proper-coding-with-date-formats/m-p/677062#M52404</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try this format:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="string token"&gt;""" "Installa_1" &amp;gt;= DATE '2010-01-01'‍‍ """&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;P&gt;&lt;/P&gt;&lt;P&gt;What type of geodatabase are you working with?&amp;nbsp; The query syntax can vary between various systems.&amp;nbsp; See: &lt;A href="https://pro.arcgis.com/en/pro-app/help/mapping/navigation/sql-reference-for-elements-used-in-query-expressions.htm" rel="nofollow noopener noreferrer" target="_blank"&gt;SQL reference for query expressions used in ArcGIS&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;EDIT:&lt;/P&gt;&lt;P&gt;I did some additional tests with a file geodatabase.&amp;nbsp; It seems that how the field is quoted (single, double or none) also has an effect.&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="comment token"&gt;# using a file geodatabase with desktop 10.5, the following also worked&lt;/SPAN&gt;

&lt;SPAN class="string token"&gt;""" 'Installa_1' &amp;gt;= '01/01/2010' """&lt;/SPAN&gt;

&lt;SPAN class="string token"&gt;"'Installa_1' &amp;gt;= '01/01/2010'"&lt;/SPAN&gt;

&lt;SPAN class="string token"&gt;"Installa_1 &amp;gt;= DATE '01/01/2010'"&lt;/SPAN&gt;

&lt;SPAN class="string token"&gt;"Installa_1 &amp;gt;= DATE '2010/01/01'"&lt;/SPAN&gt; &lt;SPAN class="comment token"&gt;# I generally use this format&lt;/SPAN&gt;


&lt;SPAN class="comment token"&gt;# the following failed&lt;/SPAN&gt;

&lt;SPAN class="string token"&gt;""" "Installa_1" &amp;gt;= '01/01/2010' """&lt;/SPAN&gt;

&lt;SPAN class="string token"&gt;"Installa_1 &amp;gt;= '01/01/2010'"&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;/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;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;/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;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 12 Dec 2021 04:31:56 GMT</pubDate>
    <dc:creator>RandyBurton</dc:creator>
    <dc:date>2021-12-12T04:31:56Z</dc:date>
    <item>
      <title>Proper coding with date formats</title>
      <link>https://community.esri.com/t5/python-questions/proper-coding-with-date-formats/m-p/677061#M52403</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE style="color: #a9b7c6; background-color: #2b2b2b; font-size: 9.8pt;"&gt;arcpy.MakeFeatureLayer_management(points&lt;SPAN style="color: #cc7832;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="color: #a5c261;"&gt;'points_layer'&lt;/SPAN&gt;&lt;SPAN style="color: #cc7832;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="color: #a5c261;"&gt;""" "Installa_1" &amp;gt;= '01/01/2010' """&lt;/SPAN&gt;)&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm new to Python and I have been trying to figure this out this line of code all day and its driving me crazy.&amp;nbsp; I keep getting an "ERROR 000358: Invalid expression&amp;nbsp; "Installa_1" &amp;gt;= '01/01/2010'&amp;nbsp; ".&amp;nbsp; The data field is in DATE format.&amp;nbsp; What is the proper way to query arcmap data by date.&amp;nbsp; I guess I'm missing something, regular SQL coding was never this bad.&amp;nbsp; If there is some special function I can Google the details.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 27 Apr 2020 19:30:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/proper-coding-with-date-formats/m-p/677061#M52403</guid>
      <dc:creator>Williams_Gregory</dc:creator>
      <dc:date>2020-04-27T19:30:16Z</dc:date>
    </item>
    <item>
      <title>Re: Proper coding with date formats</title>
      <link>https://community.esri.com/t5/python-questions/proper-coding-with-date-formats/m-p/677062#M52404</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try this format:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="string token"&gt;""" "Installa_1" &amp;gt;= DATE '2010-01-01'‍‍ """&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;P&gt;&lt;/P&gt;&lt;P&gt;What type of geodatabase are you working with?&amp;nbsp; The query syntax can vary between various systems.&amp;nbsp; See: &lt;A href="https://pro.arcgis.com/en/pro-app/help/mapping/navigation/sql-reference-for-elements-used-in-query-expressions.htm" rel="nofollow noopener noreferrer" target="_blank"&gt;SQL reference for query expressions used in ArcGIS&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;EDIT:&lt;/P&gt;&lt;P&gt;I did some additional tests with a file geodatabase.&amp;nbsp; It seems that how the field is quoted (single, double or none) also has an effect.&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="comment token"&gt;# using a file geodatabase with desktop 10.5, the following also worked&lt;/SPAN&gt;

&lt;SPAN class="string token"&gt;""" 'Installa_1' &amp;gt;= '01/01/2010' """&lt;/SPAN&gt;

&lt;SPAN class="string token"&gt;"'Installa_1' &amp;gt;= '01/01/2010'"&lt;/SPAN&gt;

&lt;SPAN class="string token"&gt;"Installa_1 &amp;gt;= DATE '01/01/2010'"&lt;/SPAN&gt;

&lt;SPAN class="string token"&gt;"Installa_1 &amp;gt;= DATE '2010/01/01'"&lt;/SPAN&gt; &lt;SPAN class="comment token"&gt;# I generally use this format&lt;/SPAN&gt;


&lt;SPAN class="comment token"&gt;# the following failed&lt;/SPAN&gt;

&lt;SPAN class="string token"&gt;""" "Installa_1" &amp;gt;= '01/01/2010' """&lt;/SPAN&gt;

&lt;SPAN class="string token"&gt;"Installa_1 &amp;gt;= '01/01/2010'"&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;/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;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;/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;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 04:31:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/proper-coding-with-date-formats/m-p/677062#M52404</guid>
      <dc:creator>RandyBurton</dc:creator>
      <dc:date>2021-12-12T04:31:56Z</dc:date>
    </item>
    <item>
      <title>Re: Proper coding with date formats</title>
      <link>https://community.esri.com/t5/python-questions/proper-coding-with-date-formats/m-p/677063#M52405</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you Randy for restoring my sanity! The first example with DATE fixed the problem.&amp;nbsp; I figured it would be a simple fix. The data was from a shapefile so I guess that is why the other examples you listed did not work.&amp;nbsp; Thanks also for the SQL reference link!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Apr 2020 13:53:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/proper-coding-with-date-formats/m-p/677063#M52405</guid>
      <dc:creator>Williams_Gregory</dc:creator>
      <dc:date>2020-04-28T13:53:24Z</dc:date>
    </item>
  </channel>
</rss>

