<?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: Use date timestamp field to select features in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/use-date-timestamp-field-to-select-features/m-p/295485#M22837</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think your'e going to have to try out a few expressions to see how it works.&amp;nbsp; Looking at the reference Dan provides, there may be some fine tuning for your particular data base.&amp;nbsp; In a general sense:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;where&amp;nbsp; YourDateField =&amp;gt; someDate and YourDateField &amp;lt;= someOtherdate&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The trick will be in how to format someDate and someOtherdate...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 30 Apr 2019 01:34:19 GMT</pubDate>
    <dc:creator>JoeBorgione</dc:creator>
    <dc:date>2019-04-30T01:34:19Z</dc:date>
    <item>
      <title>Use date timestamp field to select features</title>
      <link>https://community.esri.com/t5/python-questions/use-date-timestamp-field-to-select-features/m-p/295481#M22833</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello:&lt;BR /&gt;&lt;BR /&gt;I want a user to select a date range which will select all features in that range based on the date field. Any advice?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.esri.com/group/1519"&gt;python snippets&lt;/A&gt;‌&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 29 Apr 2019 19:00:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/use-date-timestamp-field-to-select-features/m-p/295481#M22833</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2019-04-29T19:00:29Z</dc:date>
    </item>
    <item>
      <title>Re: Use date timestamp field to select features</title>
      <link>https://community.esri.com/t5/python-questions/use-date-timestamp-field-to-select-features/m-p/295482#M22834</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You saw this? because it depends on what you are querying as well&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="https://pro.arcgis.com/en/pro-app/help/mapping/navigation/sql-reference-for-elements-used-in-query-expressions.htm" title="https://pro.arcgis.com/en/pro-app/help/mapping/navigation/sql-reference-for-elements-used-in-query-expressions.htm"&gt;SQL reference for query expressions used in ArcGIS—ArcGIS Pro | ArcGIS Desktop&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 29 Apr 2019 19:08:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/use-date-timestamp-field-to-select-features/m-p/295482#M22834</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2019-04-29T19:08:16Z</dc:date>
    </item>
    <item>
      <title>Re: Use date timestamp field to select features</title>
      <link>https://community.esri.com/t5/python-questions/use-date-timestamp-field-to-select-features/m-p/295483#M22835</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;How can you use this in a python script?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 29 Apr 2019 20:01:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/use-date-timestamp-field-to-select-features/m-p/295483#M22835</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2019-04-29T20:01:08Z</dc:date>
    </item>
    <item>
      <title>Re: Use date timestamp field to select features</title>
      <link>https://community.esri.com/t5/python-questions/use-date-timestamp-field-to-select-features/m-p/295484#M22836</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Is there a reference guide for that?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 29 Apr 2019 20:07:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/use-date-timestamp-field-to-select-features/m-p/295484#M22836</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2019-04-29T20:07:27Z</dc:date>
    </item>
    <item>
      <title>Re: Use date timestamp field to select features</title>
      <link>https://community.esri.com/t5/python-questions/use-date-timestamp-field-to-select-features/m-p/295485#M22837</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think your'e going to have to try out a few expressions to see how it works.&amp;nbsp; Looking at the reference Dan provides, there may be some fine tuning for your particular data base.&amp;nbsp; In a general sense:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;where&amp;nbsp; YourDateField =&amp;gt; someDate and YourDateField &amp;lt;= someOtherdate&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The trick will be in how to format someDate and someOtherdate...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 30 Apr 2019 01:34:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/use-date-timestamp-field-to-select-features/m-p/295485#M22837</guid>
      <dc:creator>JoeBorgione</dc:creator>
      <dc:date>2019-04-30T01:34:19Z</dc:date>
    </item>
    <item>
      <title>Re: Use date timestamp field to select features</title>
      <link>https://community.esri.com/t5/python-questions/use-date-timestamp-field-to-select-features/m-p/295486#M22838</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi &lt;A href="https://community.esri.com/migrated-users/336591"&gt;Brandon Price&lt;/A&gt;‌,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Looking for a Python example? You may want to have a look at this video, just to start somewhere:&lt;/P&gt;&lt;P&gt;&lt;A href="https://www.youtube.com/watch?v=4Uz79psbOjc"&gt;Writing Your Own Python DateTime Functions in the Arcmap Field Calculator&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;HTH,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Egge-Jan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 30 Apr 2019 08:18:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/use-date-timestamp-field-to-select-features/m-p/295486#M22838</guid>
      <dc:creator>Egge-Jan_Pollé</dc:creator>
      <dc:date>2019-04-30T08:18:02Z</dc:date>
    </item>
    <item>
      <title>Re: Use date timestamp field to select features</title>
      <link>https://community.esri.com/t5/python-questions/use-date-timestamp-field-to-select-features/m-p/295487#M22839</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;'BETWEEN' will also work in date queries.&amp;nbsp; For example with a file geodatabase:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;where = "DateTime BETWEEN DATE '2019-04-01 00:00:00' AND DATE '2019-04-30 23:59:59'"

with arcpy.da.SearchCursor(feature, ['DateTime'], where_clause=where) as cursor:
    for row in cursor:
        print row‍‍‍‍‍&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;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;You will need to check the SQL documentation for the type of geodatabase you are working with.&amp;nbsp;&amp;nbsp; And the datetime module can also be very helpful.&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;from datetime import datetime, timedelta

date_past = datetime.now() - timedelta(days=180)

wc = "DateField &amp;lt; DATE '{}'".format(date_past.strftime("%Y-%m-%d %H:%M:%S"))

print wc‍‍‍‍‍‍‍‍‍‍‍‍‍‍&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;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 14:11:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/use-date-timestamp-field-to-select-features/m-p/295487#M22839</guid>
      <dc:creator>RandyBurton</dc:creator>
      <dc:date>2021-12-11T14:11:29Z</dc:date>
    </item>
    <item>
      <title>Re: Use date timestamp field to select features</title>
      <link>https://community.esri.com/t5/python-questions/use-date-timestamp-field-to-select-features/m-p/295488#M22840</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I created a python toolbox and I am trying to recreate the select by attributes query below within it in the Start Date and end parameters.&lt;/P&gt;&lt;P&gt;Toolbox (user view):&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/445358_pastedImage_1.png" /&gt;&lt;/P&gt;&lt;P&gt;select by attributes query:&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-2 jive-image" src="https://community.esri.com/legacyfs/online/445359_pastedImage_2.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is the unfinished code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;import arcpy, os,sys&lt;BR /&gt;geoName = sys.argv[1]&lt;BR /&gt;startDate = sys.argv[2]&lt;BR /&gt;endDate = sys.argv[3]&lt;/P&gt;&lt;P&gt;desiredDate = &lt;BR /&gt;query = startDate and e&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think maybe I need to convert the current date field (which is text) to a real date using the datetime module and then use the BETWEEN statement that &lt;A href="https://community.esri.com/migrated-users/87492"&gt;Randy Burton&lt;/A&gt; suggested above to work for my class project.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 30 Apr 2019 20:14:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/use-date-timestamp-field-to-select-features/m-p/295488#M22840</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2019-04-30T20:14:00Z</dc:date>
    </item>
    <item>
      <title>Re: Use date timestamp field to select features</title>
      <link>https://community.esri.com/t5/python-questions/use-date-timestamp-field-to-select-features/m-p/295489#M22841</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I was doing some experimenting with a Python toolbox and came up with the following code:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; arcpy
&lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; datetime


&lt;SPAN class="keyword token"&gt;class&lt;/SPAN&gt; &lt;SPAN class="token class-name"&gt;Toolbox&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;object&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
    &lt;SPAN class="keyword token"&gt;def&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;__init__&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;self&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
        &lt;SPAN class="string token"&gt;"""Define the toolbox (the name of the toolbox is the name of the
        .pyt file)."""&lt;/SPAN&gt;
        self&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;label &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"Toolbox"&lt;/SPAN&gt;
        self&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;alias &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;""&lt;/SPAN&gt;

        &lt;SPAN class="comment token"&gt;# List of tool classes associated with this toolbox&lt;/SPAN&gt;
        self&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;tools &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;Tool&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;


&lt;SPAN class="keyword token"&gt;class&lt;/SPAN&gt; &lt;SPAN class="token class-name"&gt;Tool&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;object&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
    &lt;SPAN class="keyword token"&gt;def&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;__init__&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;self&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
        &lt;SPAN class="string token"&gt;"""Define the tool (tool name is the name of the class)."""&lt;/SPAN&gt;
        self&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;label &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"Tool"&lt;/SPAN&gt;
        self&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;description &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;""&lt;/SPAN&gt;
        self&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;canRunInBackground &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token boolean"&gt;False&lt;/SPAN&gt;

    &lt;SPAN class="keyword token"&gt;def&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;getParameterInfo&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;self&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
        &lt;SPAN class="string token"&gt;"""Define parameter definitions"""&lt;/SPAN&gt;

        feature &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;Parameter&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;
            displayName &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"Feature layer to search"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;
            name &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"feature"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;
            datatype &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"GPFeatureLayer"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;
            parameterType &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"Required"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;
            direction &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"Input"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

        startDate &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;Parameter&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;
            displayName &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"Select start date"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;
            name &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"startDate"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;
            datatype &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"GPDate"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;
            parameterType &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"Required"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;
            direction &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"Input"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

        endDate &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;Parameter&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;
            displayName &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"Select ending date"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;
            name &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"endDate"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;
            datatype &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"GPDate"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;
            parameterType &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"Required"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;
            direction &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"Input"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

        params &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; None
        &lt;SPAN class="keyword token"&gt;return&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt; feature&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; startDate&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; endDate &lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;

    &lt;SPAN class="keyword token"&gt;def&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;isLicensed&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;self&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
        &lt;SPAN class="string token"&gt;"""Set whether tool is licensed to execute."""&lt;/SPAN&gt;
        &lt;SPAN class="keyword token"&gt;return&lt;/SPAN&gt; &lt;SPAN class="token boolean"&gt;True&lt;/SPAN&gt;

    &lt;SPAN class="keyword token"&gt;def&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;updateParameters&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;self&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; parameters&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
        &lt;SPAN class="string token"&gt;"""Modify the values and properties of parameters before internal
        validation is performed.  This method is called whenever a parameter
        has been changed."""&lt;/SPAN&gt;
        &lt;SPAN class="keyword token"&gt;return&lt;/SPAN&gt;

    &lt;SPAN class="keyword token"&gt;def&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;updateMessages&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;self&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; parameters&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
        &lt;SPAN class="string token"&gt;"""Modify the messages created by internal validation for each tool
        parameter.  This method is called after internal validation."""&lt;/SPAN&gt;
        &lt;SPAN class="keyword token"&gt;return&lt;/SPAN&gt;

    &lt;SPAN class="keyword token"&gt;def&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;execute&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;self&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; parameters&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; messages&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
        &lt;SPAN class="string token"&gt;"""The source code of the tool."""&lt;/SPAN&gt;

        &lt;SPAN class="comment token"&gt;# the addMessages are for debugging and can be removed     &lt;/SPAN&gt;
        messages&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;addMessage&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'Feature: {}'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;format&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;parameters&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;valueAsText&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
        messages&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;addMessage&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'Start: {}'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;format&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;parameters&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;1&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;valueAsText&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
        messages&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;addMessage&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'End: {}'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;format&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;parameters&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;2&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;valueAsText&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
        messages&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;addMessage&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'Type: {}'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;format&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;type&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;parameters&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;2&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;value&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="comment token"&gt;# one way to set the time portion&lt;/SPAN&gt;
        &lt;SPAN class="comment token"&gt;# startDate = '{} 00:00:00'.format(parameters[1].value.strftime("%Y-%m-%d")) &lt;/SPAN&gt;
        &lt;SPAN class="comment token"&gt;# endDate = '{} 23:59:59'.format(parameters[2].value.strftime("%Y-%m-%d"))&lt;/SPAN&gt;

        startDate &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; parameters&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;1&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;value&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 %H:%M:%S"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
        endDate &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; parameters&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;2&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;value&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 %H:%M:%S"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

        where &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"DateTime BETWEEN DATE '{}' AND DATE '{}'"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;format&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;startDate&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; endDate&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
        messages&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;addMessage&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'Where: {}'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;format&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;where&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

        arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;SelectLayerByAttribute_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;parameters&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;valueAsText&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"NEW_SELECTION"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; where_clause&lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;where&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

        &lt;SPAN class="keyword token"&gt;return&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;/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;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;/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;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;/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;P&gt;There are lots of addMessage() for debugging.&amp;nbsp; At line 72, I used the type function to verify that the parameter being used was a datetime type.&amp;nbsp;&amp;nbsp; In addition I came across this topic: &lt;A _jive_internal="true" href="https://community.esri.com/thread/189107-arcpy-script-tool-format-parameter-date-data-type" target="_blank"&gt;arcpy script tool - format parameter Date data type&lt;/A&gt;. It may provide some additional insight in how date/time works in a Python script or toolbox.&amp;nbsp; Hope this helps.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 14:11:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/use-date-timestamp-field-to-select-features/m-p/295489#M22841</guid>
      <dc:creator>RandyBurton</dc:creator>
      <dc:date>2021-12-11T14:11:31Z</dc:date>
    </item>
    <item>
      <title>Re: Use date timestamp field to select features</title>
      <link>https://community.esri.com/t5/python-questions/use-date-timestamp-field-to-select-features/m-p/295490#M22842</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Randy:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is great. Thanks for your effort. This is what I got:&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/445375_pastedImage_1.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I apologize. I am having trouble with the where clause and getting it to synchronize with my layer. The field that I am using&amp;nbsp; is called UPDATEDATE. I tried a variety of ways to add my field to the where clause and was unsuccessful. My coworkers version is similar to yours although he is using this query variable instead of the where clause which works:&lt;/P&gt;&lt;P&gt;query = '"UPDATEDATE" &amp;lt; date \'{0}\' and "UPDATEDATE" &amp;gt; date \'{1}\''.format(endDT,startDT)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is his full version:&lt;/P&gt;&lt;P&gt;import arcpy,datetime&lt;BR /&gt;#from datetime import datetime as dt&lt;/P&gt;&lt;P&gt;FC = arcpy.GetParameterAsText(0)&lt;BR /&gt;FC_1 = FC.replace("\\","/")&lt;BR /&gt;statrDate = arcpy.GetParameterAsText(1)&lt;BR /&gt;endDate = arcpy.GetParameterAsText(2)&lt;/P&gt;&lt;P&gt;startDT = datetime.datetime.strptime(statrDate,'%m/%d/%Y %I:%M:%S %p')&lt;BR /&gt;endDT = datetime.datetime.strptime(endDate,'%m/%d/%Y %I:%M:%S %p')&lt;/P&gt;&lt;P&gt;outFC = arcpy.GetParameterAsText(3)&lt;BR /&gt;outFC_1 = outFC.replace("\\","/")&lt;BR /&gt;query = '"UPDATEDATE" &amp;lt; date \'{0}\' and "UPDATEDATE" &amp;gt; date \'{1}\''.format(endDT,startDT)&lt;BR /&gt;arcpy.Select_analysis(FC_1,outFC_1,query)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The date variables look similar to yours (startDT and endDT)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Brandon&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 01 May 2019 15:43:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/use-date-timestamp-field-to-select-features/m-p/295490#M22842</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2019-05-01T15:43:34Z</dc:date>
    </item>
    <item>
      <title>Re: Use date timestamp field to select features</title>
      <link>https://community.esri.com/t5/python-questions/use-date-timestamp-field-to-select-features/m-p/295491#M22843</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It looks like your friend is working with a custom script toolbox and not a Python toolbox.&amp;nbsp; There's some differences&amp;nbsp; in the coding and how they work.&amp;nbsp; See &lt;A href="http://desktop.arcgis.com/en/arcmap/latest/analyze/creating-tools/comparing-custom-and-python-toolboxes.htm" rel="nofollow noopener noreferrer" target="_blank"&gt;Comparing custom and Python toolboxes&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am assuming you want to use &lt;A href="http://desktop.arcgis.com/en/arcmap/latest/tools/analysis-toolbox/select.htm" rel="nofollow noopener noreferrer" target="_blank"&gt;arcpy.Select_analysis &lt;/A&gt;in your tool.&amp;nbsp; This tool requires 2 parameters with an optional where clause.&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt; Select_analysis (in_features, out_feature_class, {where_clause})&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;In my sample script, there are three parameters: one for the in_features and two for use in the where clause.&amp;nbsp; You will need to add another parameter which will be the out_feature_class.&amp;nbsp; Replace lines 47-48 with something like:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;        outFC = arcpy.Parameter(
            displayName = "Feature to be saved",
            name = "outFC",
            datatype = "DEFeatureClass",
            parameterType = "Required",
            direction = "Output")

        return [ feature, startDate, endDate, outFC ]&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;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The execute block also will need changes.&amp;nbsp; Replace lines 65 to the end with something like:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;    &lt;SPAN class="keyword token"&gt;def&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;execute&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;self&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; parameters&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; messages&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
        &lt;SPAN class="string token"&gt;"""The source code of the tool."""&lt;/SPAN&gt;

        feature &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; parameters&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;valueAsText
        startDate &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; parameters&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;1&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;value&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 %H:%M:%S"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
        endDate &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; parameters&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;2&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;value&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 %H:%M:%S"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
        outFC &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; parameters&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;3&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;valueAsText
        
        where &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"DateTime BETWEEN DATE '{}' AND DATE '{}'"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;format&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;startDate&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; endDate&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
        &lt;SPAN class="comment token"&gt;# messages.addMessage('Where: {}'.format(where))&lt;/SPAN&gt;

        arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;Select_analysis&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;feature&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; outFC&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; where&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

        &lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; i &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; range&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;GetMessageCount&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="punctuation token"&gt;:&lt;/SPAN&gt;
            messages&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;addMessage&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;GetMessage&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;i&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

        &lt;SPAN class="keyword token"&gt;return&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;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;You will need to watch the indentation as you edit your code.&amp;nbsp; Lines 14-15 ( for i in range.... GetMessage ) will print the output of the Select_analysis tool, so you can see the parameters that are passed to it and any status messages it produces.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As &lt;A href="https://community.esri.com/migrated-users/4422" target="_blank"&gt;Joe Borgione&lt;/A&gt;&amp;nbsp;pointed out in his comment will be the formatting of the time/date.&amp;nbsp; You may need to investigate the SQL reference for your geodatabase.&amp;nbsp; I am assuming that it is a file geodatabase (.gdb).&amp;nbsp;&amp;nbsp;Field names can be&amp;nbsp;put inside double quotes,&amp;nbsp;but this appears to be optional.&amp;nbsp; Date/time strings&amp;nbsp;go inside single quotes, and the DATE&amp;nbsp;in front of the string might also be optional.&amp;nbsp; Again, this depends on your geodatabase.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As you finalize your project, you may want to add some code in the updateParameters section for validating your parameters.‌&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 14:11:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/use-date-timestamp-field-to-select-features/m-p/295491#M22843</guid>
      <dc:creator>RandyBurton</dc:creator>
      <dc:date>2021-12-11T14:11:34Z</dc:date>
    </item>
  </channel>
</rss>

