<?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: Calculate Date Field. in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/calculate-date-field/m-p/708080#M54871</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think the difference you're seeing between my example and yours, is that I'm writing the datetime object to a geodatabase date field through the field calculator and you're printing the datetime object directly.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;From &lt;A class="link-titled" href="http://desktop.arcgis.com/en/arcmap/10.3/manage-data/tables/fundamentals-of-date-fields.htm" title="http://desktop.arcgis.com/en/arcmap/10.3/manage-data/tables/fundamentals-of-date-fields.htm"&gt;Fundamentals of date fields—Help | ArcGIS for Desktop:&lt;/A&gt; "A geodatabase formats the date as datetime yyyy-mm-dd hh:mm:ss AM or PM." So, no matter in which date format Python or my system settings would like to display the datetime object, once it's written to the geodatabase date field, it will be yyyy-mm-dd hh:mm:ss AM or PM.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Since you're printing the raw datetime object, it's either the Python datetime object itself or your system time settings that control what format it displays in the print output.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regarding time only format, you will have to format the datetime object into a string using &lt;A href="https://docs.python.org/2/library/datetime.html#strftime-and-strptime-behavior"&gt;strftime()&lt;/A&gt;, and write it to a string type field (won't work in date type field).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 05 Oct 2016 00:28:03 GMT</pubDate>
    <dc:creator>DarrenWiens2</dc:creator>
    <dc:date>2016-10-05T00:28:03Z</dc:date>
    <item>
      <title>Calculate Date Field.</title>
      <link>https://community.esri.com/t5/python-questions/calculate-date-field/m-p/708072#M54863</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am trying to calculate a date/time field in Python with not much luck...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In ArcGIS I am doing this with a calculate and it calculates fine...its going into a Date Field.&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt; color: #1f497d;"&gt;(Right("00" &amp;amp; [Hour],2) + ":" + Right("00" &amp;amp; [Minute],2))&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt; color: #1f497d;"&gt;result: &amp;nbsp;4:02:00 PM&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt; color: #1f497d;"&gt;I want to do this in Python and am trying this after reading in a CSV File. &amp;nbsp;No error but no result in the feature class created.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt; color: #1f497d;"&gt;If I dont get the syntax correct it tells me "Right" is not defined&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Hour = str(lineSplit[3])&lt;BR /&gt; Minute = str(lineSplit[4])&lt;/P&gt;&lt;P&gt;CalcDate1 = "Right('00' &amp;amp; Hour,2) &amp;amp; ':' &amp;amp; Right('00' &amp;amp; Minute,2)"&lt;BR /&gt; print CalcDate1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt; color: #1f497d;"&gt;It gives me this in the results window in the shell:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt; color: #1f497d;"&gt;Right('00' &amp;amp; Hour,2) &amp;amp; ':' &amp;amp; Right('00' &amp;amp; Minute,2)&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Oct 2016 18:52:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/calculate-date-field/m-p/708072#M54863</guid>
      <dc:creator>jaykapalczynski</dc:creator>
      <dc:date>2016-10-04T18:52:50Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate Date Field.</title>
      <link>https://community.esri.com/t5/python-questions/calculate-date-field/m-p/708073#M54864</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;So, are you trying to read through the CSV and get the date from different fields? &amp;nbsp;Can you show the fields?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Oct 2016 19:01:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/calculate-date-field/m-p/708073#M54864</guid>
      <dc:creator>MitchHolley1</dc:creator>
      <dc:date>2016-10-04T19:01:26Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate Date Field.</title>
      <link>https://community.esri.com/t5/python-questions/calculate-date-field/m-p/708074#M54865</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes as I parse the CSV I set the Hour and Minute to Variables...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hour Minute&lt;/P&gt;&lt;P&gt;16 &amp;nbsp; &amp;nbsp; &amp;nbsp; 2&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This results in 4:02:00 PM when I run it in ArcGIS with the formula above.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Oct 2016 19:04:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/calculate-date-field/m-p/708074#M54865</guid>
      <dc:creator>jaykapalczynski</dc:creator>
      <dc:date>2016-10-04T19:04:26Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate Date Field.</title>
      <link>https://community.esri.com/t5/python-questions/calculate-date-field/m-p/708075#M54866</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This is how I am going through the CSV and assigning the variables for each record....I then write to the Feature Class.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for ln in open (r"C:\Users\tjv36463\Desktop\Bear Collar\rangedate_D032495_20160822124736_NH.txt", 'r').readlines():&lt;BR /&gt; lineSplit = ln.split(",")&lt;BR /&gt; &lt;BR /&gt; Hour = int(lineSplit[3])&lt;BR /&gt; Minute = int(lineSplit[4])&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff;"&gt;CalcDate1 = Right('00' &amp;amp; Hour,2) &amp;amp; ':' &amp;amp; Right('00' &amp;amp; Minute,2)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff;"&gt;In ArcGIS using calculate on a date field with this:&amp;nbsp;&lt;SPAN&gt;Right('00' &amp;amp; [Hour],2) &amp;amp; ':' &amp;amp; Right('00' &amp;amp; [Minute],2)&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="background-color: #ffffff;"&gt;I get this: 4:00:00 PM it the Values were 16 for hour and 2 for Minute&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff;"&gt;Just need to translate this to Python&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="background-color: #ffffff;"&gt;Edit: &amp;nbsp;Looks like ArcGIS is converting the Military time to normal time....think I need to add this into Python or is there a date handler of some sort to do that conversion?&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Oct 2016 19:41:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/calculate-date-field/m-p/708075#M54866</guid>
      <dc:creator>jaykapalczynski</dc:creator>
      <dc:date>2016-10-04T19:41:46Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate Date Field.</title>
      <link>https://community.esri.com/t5/python-questions/calculate-date-field/m-p/708076#M54867</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;STRONG style="background-color: #ffffff; border: 0px; font-weight: bold;"&gt;think I need to add this into Python or is there a date handler of some sort to do that conversion?&lt;/STRONG&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Yes, the normal way to deal with date/time in Python is via &lt;A href="https://docs.python.org/2/library/datetime.html" rel="nofollow noopener noreferrer" target="_blank"&gt;datetime&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;e.g.&lt;/P&gt;&lt;P&gt;Expression:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;getdate&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt; !Hour! &lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; !Minute! &lt;SPAN class="punctuation token"&gt;)&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;Codeblock:&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; datetime
&lt;SPAN class="keyword token"&gt;def&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;getdate&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;hour&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; minute&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; datetime&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;datetime&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;strptime&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;str&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;hour&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;zfill&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="operator token"&gt;+&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;' '&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; str&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;minute&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;zfill&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; &lt;SPAN class="string token"&gt;'%H %M'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&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;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Result:&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/239381_pastedImage_3.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 05:44:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/calculate-date-field/m-p/708076#M54867</guid>
      <dc:creator>DarrenWiens2</dc:creator>
      <dc:date>2021-12-12T05:44:35Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate Date Field.</title>
      <link>https://community.esri.com/t5/python-questions/calculate-date-field/m-p/708077#M54868</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;STRONG&gt;Notes and references &amp;nbsp; Messing with dates and time&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Notes:&lt;BR /&gt;&lt;SPAN&gt;: - &lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.esri.com/external-link.jspa?url=http%3A%2F%2Fwww.iso.org%2Fiso%2Fsupport%2Ffaqs%2Ffaqs_widely_used_standards%2F" target="_blank"&gt;http://www.iso.org/iso/support/faqs/faqs_widely_used_standards/&lt;/A&gt;&lt;BR /&gt;: widely_used_standards_other/iso8601&lt;BR /&gt;&lt;SPAN&gt;: - &lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.esri.com/external-link.jspa?url=http%3A%2F%2Fstrftime.org" target="_blank"&gt;http://strftime.org&lt;/A&gt;&lt;BR /&gt;: - &lt;STRONG&gt;Richard Fairhurst&lt;/STRONG&gt;'s blog&lt;BR /&gt;: &lt;STRONG&gt;&lt;A class="jive-link-blog-small" data-containerid="3810" data-containertype="2020" data-objectid="1456" data-objecttype="37" href="https://community.esri.com/blogs/richard_fairhurst" target="_blank"&gt;https://community.esri.com/blogs/richard_fairhurst/2016/07/01/&lt;/A&gt;&lt;BR /&gt;: ive-saved-time-in-a-bottle-how-do-i-get-it-back-out-doing-more-&lt;BR /&gt;: with-date-fields-using-the-field-calculator-and-python&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;: - &lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.esri.com/external-link.jspa?url=https%3A%2F%2Fpymotw.com%2F3%2Fdatetime%2F" target="_blank"&gt;https://pymotw.com/3/datetime/&lt;/A&gt;&lt;BR /&gt;: The default string representation of a datetime object uses the ISO-8601 &lt;BR /&gt;: format (YYYY-MM-DDTHH:MM:SS.mmmmmm). Alternate formats can be generated&lt;BR /&gt;: using strftime().&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;windows 3.x 2.7 from Richards&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;yy or y = %y (Year number without century with or without a leading zero)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;yyyy = %Y (Year number with century)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;MM or M = %m (Month number with or without a leading zero)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;MMM = %b (Month as locale’s abbreviated name)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;MMMM = %B (Month as locale’s full name)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;dd or d = %d (Day of the month number with or without a leading zero)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;ddd = %a (Weekday as locale’s abbreviated name)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;dddd = %A (Weekday as locale’s full name)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;hh or h = %I (Hour (12-hour clock) with or without a leading zero)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;HH or H = %H (Hour (24-hour clock) with or without a leading zero)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;mm or m = %M (Minute number with or without a leading zero)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;ss or s = %S (Second number with or without a leading zero)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;tt = %p (Locale’s equivalent of either AM or PM)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;/, -, : = /, -, : (literal date or time separator characters)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Test output... fiddle with the options above to get what you want&lt;/P&gt;&lt;P&gt;&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;_demo&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;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="string token"&gt;"""&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; :Required:
&amp;nbsp;&amp;nbsp;&amp;nbsp; :--------
&amp;nbsp;&amp;nbsp;&amp;nbsp; :&amp;nbsp; import datetime
&amp;nbsp;&amp;nbsp;&amp;nbsp; :Returns
&amp;nbsp;&amp;nbsp;&amp;nbsp; :-------
&amp;nbsp;&amp;nbsp;&amp;nbsp; :
&amp;nbsp;&amp;nbsp;&amp;nbsp; """&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; today &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; datetime&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;datetime&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;today&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'ISO&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; :'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; today&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'format(): {:%a %b %d %H:%M:%S %Y}'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;format&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;today&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="keyword token"&gt;return&lt;/SPAN&gt; today
&amp;nbsp;&amp;nbsp;&amp;nbsp; 

&lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt; __name__&lt;SPAN class="operator token"&gt;==&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"__main__"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="string token"&gt;"""&amp;nbsp;&amp;nbsp; """&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="comment token"&gt;#print("Script... {}".format(script))&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; a&amp;nbsp; &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; _demo&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&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;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sample output.... change line 12 to get what you want&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;ISO&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;2016&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;-&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;10&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;-&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;04&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;17&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;06&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;34.598792&lt;/SPAN&gt;
format&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; Tue Oct &lt;SPAN class="number token"&gt;04&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;17&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;06&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;34&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;2016&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;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 05:44:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/calculate-date-field/m-p/708077#M54868</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2021-12-12T05:44:37Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate Date Field.</title>
      <link>https://community.esri.com/t5/python-questions/calculate-date-field/m-p/708078#M54869</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Think I got it....one second...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. I still get military time and missing the AM PM&lt;/P&gt;&lt;P&gt;2. Only looking for the time not the date on the front...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Not really....did this and got this..but getting closer...&lt;/P&gt;&lt;P&gt;If I use this I get error: &amp;nbsp;&lt;SPAN&gt;getDateTime = getdate(!Hour!, !Minute!)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;RESULT:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;1900-01-01 20:01:00&lt;BR /&gt;1900-01-01 00:01:00&lt;BR /&gt;1900-01-01 04:01:00&lt;BR /&gt;1900-01-01 12:02:00&lt;BR /&gt;1900-01-01 16:01:00&lt;BR /&gt;1900-01-01 20:01:00&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;CODE:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;import arcpy&lt;BR /&gt;import datetime&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #ff0000;"&gt;def getdate(hour, minute):&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #ff0000;"&gt; return datetime.datetime.strptime(str(Hour).zfill(2) + ' ' + str(Minute).zfill(2), '%H %M')&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;fc = r'C:\Users\tjv36463\Desktop\Bear Collar\BearLocationImports.gdb\BearCollar'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;cursor = arcpy.da.InsertCursor (fc,["CollarSeri", "Year", "Julianday", "Hour", "Minute", "Activity", "Temperatur", "Latitude", "Longitude", "HDOP", "NumSats", "FixTime", "Date", "_2D_3D", "BearID", "SHAPE@XY"])&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;for ln in open (r"C:\Users\tjv36463\Desktop\Bear Collar\rangedate_D032495_20160822124736_NH.txt", 'r').readlines():&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; lineSplit = ln.split(",")&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; Hour = int(lineSplit[3])&lt;BR /&gt; Minute = int(lineSplit[4])&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;SPAN style="color: #ff0000;"&gt;getDateTime = getdate(Hour, Minute)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #ff0000;"&gt; print getDateTime&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Oct 2016 00:01:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/calculate-date-field/m-p/708078#M54869</guid>
      <dc:creator>jaykapalczynski</dc:creator>
      <dc:date>2016-10-05T00:01:41Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate Date Field.</title>
      <link>https://community.esri.com/t5/python-questions/calculate-date-field/m-p/708079#M54870</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Did you import datetime? Otherwise, what's the full error message?&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Oct 2016 00:11:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/calculate-date-field/m-p/708079#M54870</guid>
      <dc:creator>DarrenWiens2</dc:creator>
      <dc:date>2016-10-05T00:11:24Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate Date Field.</title>
      <link>https://community.esri.com/t5/python-questions/calculate-date-field/m-p/708080#M54871</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think the difference you're seeing between my example and yours, is that I'm writing the datetime object to a geodatabase date field through the field calculator and you're printing the datetime object directly.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;From &lt;A class="link-titled" href="http://desktop.arcgis.com/en/arcmap/10.3/manage-data/tables/fundamentals-of-date-fields.htm" title="http://desktop.arcgis.com/en/arcmap/10.3/manage-data/tables/fundamentals-of-date-fields.htm"&gt;Fundamentals of date fields—Help | ArcGIS for Desktop:&lt;/A&gt; "A geodatabase formats the date as datetime yyyy-mm-dd hh:mm:ss AM or PM." So, no matter in which date format Python or my system settings would like to display the datetime object, once it's written to the geodatabase date field, it will be yyyy-mm-dd hh:mm:ss AM or PM.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Since you're printing the raw datetime object, it's either the Python datetime object itself or your system time settings that control what format it displays in the print output.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regarding time only format, you will have to format the datetime object into a string using &lt;A href="https://docs.python.org/2/library/datetime.html#strftime-and-strptime-behavior"&gt;strftime()&lt;/A&gt;, and write it to a string type field (won't work in date type field).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Oct 2016 00:28:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/calculate-date-field/m-p/708080#M54871</guid>
      <dc:creator>DarrenWiens2</dc:creator>
      <dc:date>2016-10-05T00:28:03Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate Date Field.</title>
      <link>https://community.esri.com/t5/python-questions/calculate-date-field/m-p/708081#M54872</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;When I use my example above why do I still get military time and no AM PM...I can deal with the date at the front...just want the time to at least come out right. &amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Im gonna write this to a GDB field and see if it differs....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;THANKS for you help....very much appreciated.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Oct 2016 00:40:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/calculate-date-field/m-p/708081#M54872</guid>
      <dc:creator>jaykapalczynski</dc:creator>
      <dc:date>2016-10-05T00:40:42Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate Date Field.</title>
      <link>https://community.esri.com/t5/python-questions/calculate-date-field/m-p/708082#M54873</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That did it....when I wrote to my GDB field it was in normal time and had the AM PM on it....with my lack of knowledge here I think I might just strip the characters(Date) from the front of the variable and try that....I hate dates....&lt;/P&gt;&lt;P&gt;Unless you have an example of the .strftime&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Oct 2016 00:46:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/calculate-date-field/m-p/708082#M54873</guid>
      <dc:creator>jaykapalczynski</dc:creator>
      <dc:date>2016-10-05T00:46:22Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate Date Field.</title>
      <link>https://community.esri.com/t5/python-questions/calculate-date-field/m-p/708083#M54874</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If I could get that one last step to only time I would be done...I cant thank you enough for this help...newbee is very grateful.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Oct 2016 00:55:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/calculate-date-field/m-p/708083#M54874</guid>
      <dc:creator>jaykapalczynski</dc:creator>
      <dc:date>2016-10-05T00:55:48Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate Date Field.</title>
      <link>https://community.esri.com/t5/python-questions/calculate-date-field/m-p/708084#M54875</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I did it like this but dont think this is the best way....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;getDateTime = getdate(Hour, Minute)&lt;BR /&gt;getDateTime2 = str(getDateTime)&lt;BR /&gt; getDateTime3 = getDateTime2[-8:]&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;# send getDateTime3 to the insert....came out alright...but lots of processing....&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Oct 2016 01:03:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/calculate-date-field/m-p/708084#M54875</guid>
      <dc:creator>jaykapalczynski</dc:creator>
      <dc:date>2016-10-05T01:03:30Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate Date Field.</title>
      <link>https://community.esri.com/t5/python-questions/calculate-date-field/m-p/708085#M54876</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yeah, I hate dates, too. I've gotten by only using the &lt;A href="https://docs.python.org/2/library/datetime.html#strftime-and-strptime-behavior" rel="nofollow noopener noreferrer" target="_blank"&gt;final section&lt;/A&gt; of the datetime help page, where it explains strptime (converts string to datetime), strftime (converts datetime to string), and the date formatting codes.&lt;/P&gt;&lt;P&gt;&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; datetime 
my_string &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'7:30AM March 15, 2000'&lt;/SPAN&gt; &lt;SPAN class="comment token"&gt;# some date&lt;/SPAN&gt;
dt &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; datetime&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;datetime&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;strptime&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;my_string&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'%H:%M%p %B %d, %Y'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="comment token"&gt;# create datetime object from string&lt;/SPAN&gt;
my_new_string &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; dt&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;'%H-----%M'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="comment token"&gt;# create a string from some parts of the datetime object&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt; my_new_string‍‍‍‍‍&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;&lt;/P&gt;&lt;P&gt;Result:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="number token"&gt;07&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;-&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;-&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;-&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;-&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;-&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;30&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;Some things I think about (whether they're wrong or right):&lt;/P&gt;&lt;P&gt;- the datetime object is sort of formatless, but has all formats available through strftime (I suspect the format is defined in the help)&lt;/P&gt;&lt;P&gt;- datetime objects are very smart when it comes to date operations (like "what is the time 2074 minutes from 9:00pm on Friday, June 29?")&lt;/P&gt;&lt;P&gt;- those date formatting codes are important, and that's how you pull out the time components of the datetime object via strftime()&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 05:44:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/calculate-date-field/m-p/708085#M54876</guid>
      <dc:creator>DarrenWiens2</dc:creator>
      <dc:date>2021-12-12T05:44:40Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate Date Field.</title>
      <link>https://community.esri.com/t5/python-questions/calculate-date-field/m-p/708086#M54877</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Mitch Holley, Darren Wiens THANK YOU FOR YOUR HELP AND SUPPORT....Things are running great...although not the most efficient way but I got it...with YOUR help of course&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ANY QUESTIONS: &amp;nbsp;please feel free to reply and I will get back with you..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;THANKS Again Mitch and Darren....SOOOO very much appreciated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. Read CSV to file to get all records&lt;/P&gt;&lt;P&gt;2.&amp;nbsp;I calculated the Time field (CalcTime) from an Hour and Minute Field..&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;12:02:00 AM&lt;/P&gt;&lt;P&gt;3. Once I had that I calculated the Full CalcDateTime field from CalcTime above and the Date field from the CSV&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 6/29/2016 12:02:00 AM&amp;nbsp;&lt;/P&gt;&lt;P&gt;4. Inserted ROWS into the Feature Class using &lt;A href="mailto:SHAPE@XY"&gt;SHAPE@XY&lt;/A&gt;&amp;nbsp;Token to create the geometry&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Hour Minute from CSV File&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;0 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;2&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;getTime3 Variable -&amp;nbsp;CalcTime Field Result in New Feature Class&lt;/STRONG&gt;&lt;BR /&gt;12:02:00 AM&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;getDateTime Variable -&amp;nbsp;CalcDateTime field result in the New Feature Class concatenated with the Date field from the CSV File&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;6/29/2016 12:02:00 AM&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="text-decoration: underline;"&gt;&lt;STRONG&gt;FULL CODE BELOW&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;import arcpy&lt;BR /&gt;import datetime&lt;/P&gt;&lt;P&gt;def getdate(Hour, Minute):&lt;BR /&gt;return datetime.datetime.strptime(str(Hour).zfill(2) + ' ' + str(Minute).zfill(2), '%H %M')&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;fc = r'C:\Users\\Collar\BearLocationImports.gdb\BearCollar'&lt;BR /&gt; &lt;BR /&gt;cursor = arcpy.da.InsertCursor (fc,["CollarSeri", "Year", "Julianday", "Hour", "Minute", "Activity", "Temperatur", "Latitude", "Longitude", "HDOP", "NumSats", "FixTime", "Date", "_2D_3D", "BearID", "CalcDate", "CalcDate3", "SHAPE@XY"])&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;for ln in open (r"C:\Users\tjv36463\Desktop\Bear Collar\rangedate_D032495_20160822124736_NH.txt", 'r').readlines():&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; #Each line in the csv is a string, so turn it into a list so you can reference each column&lt;BR /&gt; lineSplit = ln.split(",")&lt;/P&gt;&lt;P&gt;#Use index positions to get the right column from the csv&lt;BR /&gt; #Make sure the data is the correct type (i.e. X and Y need to be numbers, not strings)&lt;BR /&gt;CollarSeri = long(lineSplit[0])&lt;BR /&gt; Year = str(lineSplit[1])&lt;BR /&gt; Julianday = str(lineSplit[2])&lt;BR /&gt; Hour = int(lineSplit[3])&lt;BR /&gt; Minute = int(lineSplit[4])&lt;BR /&gt; Activity = int(lineSplit[5])&lt;BR /&gt; Temperature = int(lineSplit[6])&lt;BR /&gt; Latitude = float(lineSplit[7])&lt;BR /&gt; Longitude = float(lineSplit[8])&lt;BR /&gt; HDOP = str(lineSplit[9])&lt;BR /&gt; NumSats = int(lineSplit[10])&lt;BR /&gt; FixTime = int(lineSplit[11])&lt;BR /&gt; _2D_3D = int(lineSplit[12])&lt;/P&gt;&lt;P&gt;BearID = 0&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Date = str(lineSplit[13]) # working with Date Time &lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.esri.com/external-link.jspa?url=http%3A%2F%2Fstackoverflow.com%2Fquestions%2F1521906%2Fhow-to-specify-date-and-time-in-python" rel="nofollow" target="_blank"&gt;http://stackoverflow.com/questions/1521906/how-to-specify-date-and-time-in-python&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;getTime = getdate(Hour, Minute)&lt;BR /&gt; getTime2 = str(getTime)&lt;BR /&gt; getTime3 = getTime2[-8:]&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;getDateTime = (Date + getTime3)&lt;BR /&gt; print getDateTime&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;shapeVal = (Longitude, Latitude)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;#Insert the values from csv into feature class&lt;BR /&gt;cursor.insertRow ([CollarSeri, Year, Julianday, Hour, Minute, Activity, Temperature, Latitude, Longitude, HDOP, NumSats, FixTime, Date, _2D_3D, BearID, getTime3, getDateTime, shapeVal])&lt;/P&gt;&lt;P&gt;count += 1&lt;/P&gt;&lt;P&gt;del cursor&lt;BR /&gt;print ("done")&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Oct 2016 01:29:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/calculate-date-field/m-p/708086#M54877</guid>
      <dc:creator>jaykapalczynski</dc:creator>
      <dc:date>2016-10-05T01:29:12Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate Date Field.</title>
      <link>https://community.esri.com/t5/python-questions/calculate-date-field/m-p/708087#M54878</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dude cant thank you enough for all your help…it is so gratefully appreciated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Jay&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Jay Kapalczynski&lt;/P&gt;&lt;P&gt;GIS Coordinator - Virginia Department of Game &amp;amp; Inland Fisheries&lt;/P&gt;&lt;P&gt;(new address) 7870 Villa Park Drive Suite 400, Henrico VA 23228&lt;/P&gt;&lt;P&gt;Phone: 804.367.6796 | Fax: 804.367.2628&lt;/P&gt;&lt;P&gt;ü Please consider the environment before printing this email.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Oct 2016 01:40:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/calculate-date-field/m-p/708087#M54878</guid>
      <dc:creator>jaykapalczynski</dc:creator>
      <dc:date>2016-10-05T01:40:01Z</dc:date>
    </item>
  </channel>
</rss>

