<?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 Field - Different Date Format in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/date-field-different-date-format/m-p/1011614#M59362</link>
    <description>&lt;P&gt;produce a string field of the dates using this principle&lt;/P&gt;&lt;LI-CODE lang="python"&gt;d = ["2/25/2010 7:41:00 AM", "7/9/2008"]

[i.split(" ")[0] for i in d]
['2/25/2010', '7/9/2008']

# ---- field calculator perhaps ...  str(!YourField!).split(" ")[0]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/tool-reference/data-management/convert-time-field.htm" target="_blank"&gt;Convert Time Field (Data Management)—ArcGIS Pro | Documentation&lt;/A&gt;&lt;/P&gt;&lt;P&gt;for other information&lt;/P&gt;</description>
    <pubDate>Mon, 21 Dec 2020 23:13:49 GMT</pubDate>
    <dc:creator>DanPatterson</dc:creator>
    <dc:date>2020-12-21T23:13:49Z</dc:date>
    <item>
      <title>Date Field - Different Date Format</title>
      <link>https://community.esri.com/t5/python-questions/date-field-different-date-format/m-p/1011607#M59360</link>
      <description>&lt;P&gt;Lets say I have a DATE field that is populated from a different database. However, within the field the dates/times are produced differently. Some may be 2/25/2010 7:41:00 AM and others *In the Same Field* are 7/9/2008 *Missing the time*&lt;/P&gt;&lt;P&gt;When I run the script on the whole column and try to convert, it crashes due to different date formats.&amp;nbsp;&lt;/P&gt;&lt;P&gt;My goal is to get all of them into the Day of the Week, month day and year. I have figured out how to do that part but with (2) sometimes (3) different date formats, its not working. Is there a way to take ALL of the dates, regardless if they are different format and convert them ALL to the same format?&lt;/P&gt;&lt;P&gt;So, 2/25/2010 7:41:00 AM and 7/9/2008 with ONE command would change to Weekday, Month Day, Year?&lt;/P&gt;&lt;P&gt;I am stuck and my research isn't working.&lt;/P&gt;&lt;P&gt;Thank You&lt;/P&gt;</description>
      <pubDate>Mon, 21 Dec 2020 22:48:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/date-field-different-date-format/m-p/1011607#M59360</guid>
      <dc:creator>ModernElectric</dc:creator>
      <dc:date>2020-12-21T22:48:33Z</dc:date>
    </item>
    <item>
      <title>Re: Date Field - Different Date Format</title>
      <link>https://community.esri.com/t5/python-questions/date-field-different-date-format/m-p/1011614#M59362</link>
      <description>&lt;P&gt;produce a string field of the dates using this principle&lt;/P&gt;&lt;LI-CODE lang="python"&gt;d = ["2/25/2010 7:41:00 AM", "7/9/2008"]

[i.split(" ")[0] for i in d]
['2/25/2010', '7/9/2008']

# ---- field calculator perhaps ...  str(!YourField!).split(" ")[0]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/tool-reference/data-management/convert-time-field.htm" target="_blank"&gt;Convert Time Field (Data Management)—ArcGIS Pro | Documentation&lt;/A&gt;&lt;/P&gt;&lt;P&gt;for other information&lt;/P&gt;</description>
      <pubDate>Mon, 21 Dec 2020 23:13:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/date-field-different-date-format/m-p/1011614#M59362</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2020-12-21T23:13:49Z</dc:date>
    </item>
    <item>
      <title>Re: Date Field - Different Date Format</title>
      <link>https://community.esri.com/t5/python-questions/date-field-different-date-format/m-p/1011615#M59363</link>
      <description>&lt;P&gt;BINGO. Dang Dan I sure wish I had your expertise.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Let me pick your brain one more time. This converts the DATE field to a different TEXT field. From here, how would I take the text field and convert the 12/12/2020 to Monday, December 21, 2020&lt;/P&gt;&lt;P&gt;I have been using the Convert Time Field tool in Python but it takes a very very LONG time to complete. I have found using Field Calculator is much much FASTER.&lt;/P&gt;</description>
      <pubDate>Mon, 21 Dec 2020 23:25:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/date-field-different-date-format/m-p/1011615#M59363</guid>
      <dc:creator>ModernElectric</dc:creator>
      <dc:date>2020-12-21T23:25:59Z</dc:date>
    </item>
    <item>
      <title>Re: Date Field - Different Date Format</title>
      <link>https://community.esri.com/t5/python-questions/date-field-different-date-format/m-p/1011642#M59364</link>
      <description>&lt;P&gt;If you chose any other datetime format other one that requires you to specify the "Day" of the week in M, T, W... format, you would find that the Convert Time Field would take way less time, since it has to figure out what day of the week December 21st is.&lt;/P&gt;&lt;P&gt;It is an ugly process&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import datetime
d = "12/21/2020"  # ---- an example data, aka, your field
dt = datetime.datetime.strptime(d, "%m/%d/%Y")  # make it a datetime thingy
dt.strftime('%A, %B %d %Y')  # ---- reformatted separately, check python help

'Monday, December 21 2020'  # --- you can put commas in and other stuff&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 22 Dec 2020 02:27:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/date-field-different-date-format/m-p/1011642#M59364</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2020-12-22T02:27:30Z</dc:date>
    </item>
  </channel>
</rss>

