<?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: Create DateTime from separate Date and Time fields in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/create-datetime-from-separate-date-and-time-fields/m-p/1032308#M38073</link>
    <description>&lt;P&gt;Thanks Dan, I got it to work.&lt;/P&gt;&lt;P&gt;Expression: convertdatetime(!time_from!,!date_from!)&lt;/P&gt;&lt;P&gt;Code Block:&lt;/P&gt;&lt;P&gt;def convertdatetime(sTime, dDate):&lt;BR /&gt;&amp;nbsp; &amp;nbsp; tTime = datetime.strptime(sTime, '%H:%M').time()&lt;BR /&gt;&amp;nbsp; &amp;nbsp; dt = datetime.combine(dDate, tTime)&lt;BR /&gt;&amp;nbsp; &amp;nbsp; return dt&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I was hoping to wrap it up into a single statement but it doesn't work for some reason, something like:&lt;/P&gt;&lt;P&gt;datetime.combine(!date_from!, datetime.strptime(!time_from!, '%H:%M').time())&lt;/P&gt;&lt;P&gt;But that's ok, the solution works so I'm happy with that.&lt;/P&gt;</description>
    <pubDate>Wed, 03 Mar 2021 03:59:20 GMT</pubDate>
    <dc:creator>ToyotaT18</dc:creator>
    <dc:date>2021-03-03T03:59:20Z</dc:date>
    <item>
      <title>Create DateTime from separate Date and Time fields</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/create-datetime-from-separate-date-and-time-fields/m-p/1031854#M38031</link>
      <description>&lt;P&gt;I have a CSV dataset which has separate date and time fields. When imported to a feature class, the date field is of type 'date' and the time field is 'text'. I want to keep these separate, but add a new field to store a DateTime, ie a combination of the date and time. Can someone let me know how to enter this in the field calculator? I've tried using strptime() but it doesn't seem to let me cast the date as a string. Thanks.&lt;/P&gt;</description>
      <pubDate>Tue, 02 Mar 2021 11:18:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/create-datetime-from-separate-date-and-time-fields/m-p/1031854#M38031</guid>
      <dc:creator>ToyotaT18</dc:creator>
      <dc:date>2021-03-02T11:18:18Z</dc:date>
    </item>
    <item>
      <title>Re: Create DateTime from separate Date and Time fields</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/create-datetime-from-separate-date-and-time-fields/m-p/1031857#M38032</link>
      <description>&lt;P&gt;datetime combine?&lt;/P&gt;&lt;P&gt;There are python examples&lt;/P&gt;&lt;P&gt;&lt;A href="https://stackoverflow.com/questions/9578906/easiest-way-to-combine-date-and-time-strings-to-single-datetime-object-using-pyt" target="_blank" rel="noopener"&gt;Easiest way to combine date and time strings to single datetime object using Python - Stack Overflow&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Since you have already have the data in a field, it would be a matter of converting the time appropriately then combining.&amp;nbsp; The contents of your text time field would determine what the final formula would look like&lt;/P&gt;</description>
      <pubDate>Tue, 02 Mar 2021 11:36:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/create-datetime-from-separate-date-and-time-fields/m-p/1031857#M38032</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2021-03-02T11:36:36Z</dc:date>
    </item>
    <item>
      <title>Re: Create DateTime from separate Date and Time fields</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/create-datetime-from-separate-date-and-time-fields/m-p/1032101#M38054</link>
      <description>&lt;P&gt;The easiest approach may be to first open up the CSV in Excel and then combine the two fields into one field using a formula such as "=TEXT(C2,"yyyy/m/dd ")&amp;amp;TEXT(D2,"hh:mm:ss")". But then once you add the CSV file to Pro, your new field will be recognised as a text field and not a date field, so then you need to run the&amp;nbsp;&lt;STRONG&gt;Convert Time Field&lt;/STRONG&gt; GP tool to convert it to a date field.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 02 Mar 2021 19:50:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/create-datetime-from-separate-date-and-time-fields/m-p/1032101#M38054</guid>
      <dc:creator>MervynLotter</dc:creator>
      <dc:date>2021-03-02T19:50:54Z</dc:date>
    </item>
    <item>
      <title>Re: Create DateTime from separate Date and Time fields</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/create-datetime-from-separate-date-and-time-fields/m-p/1032308#M38073</link>
      <description>&lt;P&gt;Thanks Dan, I got it to work.&lt;/P&gt;&lt;P&gt;Expression: convertdatetime(!time_from!,!date_from!)&lt;/P&gt;&lt;P&gt;Code Block:&lt;/P&gt;&lt;P&gt;def convertdatetime(sTime, dDate):&lt;BR /&gt;&amp;nbsp; &amp;nbsp; tTime = datetime.strptime(sTime, '%H:%M').time()&lt;BR /&gt;&amp;nbsp; &amp;nbsp; dt = datetime.combine(dDate, tTime)&lt;BR /&gt;&amp;nbsp; &amp;nbsp; return dt&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I was hoping to wrap it up into a single statement but it doesn't work for some reason, something like:&lt;/P&gt;&lt;P&gt;datetime.combine(!date_from!, datetime.strptime(!time_from!, '%H:%M').time())&lt;/P&gt;&lt;P&gt;But that's ok, the solution works so I'm happy with that.&lt;/P&gt;</description>
      <pubDate>Wed, 03 Mar 2021 03:59:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/create-datetime-from-separate-date-and-time-fields/m-p/1032308#M38073</guid>
      <dc:creator>ToyotaT18</dc:creator>
      <dc:date>2021-03-03T03:59:20Z</dc:date>
    </item>
  </channel>
</rss>

