<?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: Date query on File GDB in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/date-query-on-file-gdb/m-p/244316#M18984</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I am actually passing it in as a variable.&amp;nbsp; I build the string up programmatically and print the whereclause using addMessage and this is how it prints out, which works if using the query builder.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 31 Aug 2012 19:18:14 GMT</pubDate>
    <dc:creator>KevinBell</dc:creator>
    <dc:date>2012-08-31T19:18:14Z</dc:date>
    <item>
      <title>Date query on File GDB</title>
      <link>https://community.esri.com/t5/python-questions/date-query-on-file-gdb/m-p/244314#M18982</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I'm getting aggravating results trying to query a date time field in a fgdb... &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If I use this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;"gpstime" &amp;gt; date '2011-06-14 10:00:00' AND "gpstime" &amp;lt; date '2011-06-14 11:00:00'&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;in the select by attributes dialog in arcmap it works fine, but using it as the whereclause in&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;arcpy.SelectLayerByAttribute i get the wrong times.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;ideas?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 31 Aug 2012 17:08:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/date-query-on-file-gdb/m-p/244314#M18982</guid>
      <dc:creator>KevinBell</dc:creator>
      <dc:date>2012-08-31T17:08:59Z</dc:date>
    </item>
    <item>
      <title>Re: Date query on File GDB</title>
      <link>https://community.esri.com/t5/python-questions/date-query-on-file-gdb/m-p/244315#M18983</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;I'm getting aggravating results trying to query a date time field in a fgdb... &lt;BR /&gt;&lt;BR /&gt;If I use this:&lt;BR /&gt;&lt;BR /&gt;"gpstime" &amp;gt; date '2011-06-14 10:00:00' AND "gpstime" &amp;lt; date '2011-06-14 11:00:00'&lt;BR /&gt;&lt;BR /&gt;in the select by attributes dialog in arcmap it works fine, but using it as the whereclause in&lt;BR /&gt;arcpy.SelectLayerByAttribute i get the wrong times.&amp;nbsp; &lt;BR /&gt;&lt;BR /&gt;ideas?&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;There might be an issue with the quotations.&amp;nbsp; You could try to set it as a string variable, and passing the variable as the query:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
query = "\"gpstime\" &amp;gt; date '2011-06-14 10:00:00' AND \"gpstime\" &amp;lt; date '2011-06-14 11:00:00'"

arcpy.SelectLayerByAttributes_management(lyr, "NEW_SELECTION", query)
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;edit:&amp;nbsp; notice the slashes I used in the query string to ignore ending the full string&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 12:11:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/date-query-on-file-gdb/m-p/244315#M18983</guid>
      <dc:creator>KevinYanuk</dc:creator>
      <dc:date>2021-12-11T12:11:57Z</dc:date>
    </item>
    <item>
      <title>Re: Date query on File GDB</title>
      <link>https://community.esri.com/t5/python-questions/date-query-on-file-gdb/m-p/244316#M18984</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I am actually passing it in as a variable.&amp;nbsp; I build the string up programmatically and print the whereclause using addMessage and this is how it prints out, which works if using the query builder.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 31 Aug 2012 19:18:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/date-query-on-file-gdb/m-p/244316#M18984</guid>
      <dc:creator>KevinBell</dc:creator>
      <dc:date>2012-08-31T19:18:14Z</dc:date>
    </item>
    <item>
      <title>Re: Date query on File GDB</title>
      <link>https://community.esri.com/t5/python-questions/date-query-on-file-gdb/m-p/244317#M18985</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;User Error!&amp;nbsp; I shouldn't program on Friday afternoons!&amp;nbsp; I just had a problem buried in the routine that builds the query.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 31 Aug 2012 19:35:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/date-query-on-file-gdb/m-p/244317#M18985</guid>
      <dc:creator>KevinBell</dc:creator>
      <dc:date>2012-08-31T19:35:13Z</dc:date>
    </item>
  </channel>
</rss>

