<?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: Need help getting year from a date field (field calculator) in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/need-help-getting-year-from-a-date-field-field/m-p/269363#M20753</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I didn't know arcpy had its own time. Put on your parachute pants and get ready for &lt;EM&gt;Esri Time!&lt;/EM&gt; a parady of Hammer Time! &lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/laugh.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 03 Jun 2016 17:36:13 GMT</pubDate>
    <dc:creator>BlakeTerhune</dc:creator>
    <dc:date>2016-06-03T17:36:13Z</dc:date>
    <item>
      <title>Need help getting year from a date field (field calculator)</title>
      <link>https://community.esri.com/t5/python-questions/need-help-getting-year-from-a-date-field-field/m-p/269358#M20748</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have dates (in a date field) of mixed formatting (1/21/2006 4:19:20 AM, 12/27/2007, etc.). I need to populate an integer field with just the year.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Based on &lt;A _jive_internal="true" href="https://community.esri.com/message/363603#http:" target="_blank"&gt;this thread&lt;/A&gt; I'm trying to work my way through it but I can't get it figured out&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;d = datetime.datetime.strptime(!InstallDate!, "%d/%m/%Y")
justyr = datetime.datetime(d.year)&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any help would be appreciated!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 13:11:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/need-help-getting-year-from-a-date-field-field/m-p/269358#M20748</guid>
      <dc:creator>RobBlash</dc:creator>
      <dc:date>2021-12-11T13:11:02Z</dc:date>
    </item>
    <item>
      <title>Re: Need help getting year from a date field (field calculator)</title>
      <link>https://community.esri.com/t5/python-questions/need-help-getting-year-from-a-date-field-field/m-p/269359#M20749</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try this:&lt;/P&gt;&lt;PRE __default_attr="python" __jive_macro_name="code" class="_jivemacro_uid_14649617578158485 jive_macro_code jive_text_macro" data-renderedposition="34_8_982_16" jivemacro_uid="_14649617578158485"&gt;&lt;P&gt;arcpy.time.FormatDate( !InstallDate!, 'yyyy')&lt;/P&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Jun 2016 13:49:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/need-help-getting-year-from-a-date-field-field/m-p/269359#M20749</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2016-06-03T13:49:19Z</dc:date>
    </item>
    <item>
      <title>Re: Need help getting year from a date field (field calculator)</title>
      <link>https://community.esri.com/t5/python-questions/need-help-getting-year-from-a-date-field-field/m-p/269360#M20750</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;IMG class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/206787_pastedImage_0.png" style="max-width: 1200px; max-height: 900px;" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Jun 2016 13:54:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/need-help-getting-year-from-a-date-field-field/m-p/269360#M20750</guid>
      <dc:creator>WesMiller</dc:creator>
      <dc:date>2016-06-03T13:54:16Z</dc:date>
    </item>
    <item>
      <title>Re: Need help getting year from a date field (field calculator)</title>
      <link>https://community.esri.com/t5/python-questions/need-help-getting-year-from-a-date-field-field/m-p/269361#M20751</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks, not sure why this was impossible to find (I searched and searched....).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Jun 2016 14:02:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/need-help-getting-year-from-a-date-field-field/m-p/269361#M20751</guid>
      <dc:creator>RobBlash</dc:creator>
      <dc:date>2016-06-03T14:02:30Z</dc:date>
    </item>
    <item>
      <title>Re: Need help getting year from a date field (field calculator)</title>
      <link>https://community.esri.com/t5/python-questions/need-help-getting-year-from-a-date-field-field/m-p/269362#M20752</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks! Looks like dateutil has a lot of useful functions, which I'm sure will be helpful as I learn more python and tackle more complex problems.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Jun 2016 14:05:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/need-help-getting-year-from-a-date-field-field/m-p/269362#M20752</guid>
      <dc:creator>RobBlash</dc:creator>
      <dc:date>2016-06-03T14:05:09Z</dc:date>
    </item>
    <item>
      <title>Re: Need help getting year from a date field (field calculator)</title>
      <link>https://community.esri.com/t5/python-questions/need-help-getting-year-from-a-date-field-field/m-p/269363#M20753</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I didn't know arcpy had its own time. Put on your parachute pants and get ready for &lt;EM&gt;Esri Time!&lt;/EM&gt; a parady of Hammer Time! &lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/laugh.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Jun 2016 17:36:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/need-help-getting-year-from-a-date-field-field/m-p/269363#M20753</guid>
      <dc:creator>BlakeTerhune</dc:creator>
      <dc:date>2016-06-03T17:36:13Z</dc:date>
    </item>
    <item>
      <title>Re: Need help getting year from a date field (field calculator)</title>
      <link>https://community.esri.com/t5/python-questions/need-help-getting-year-from-a-date-field-field/m-p/269364#M20754</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The &lt;A href="http://desktop.arcgis.com/en/arcmap/latest/analyze/arcpy-time/what-is-the-time-module-.htm"&gt;ArcPy Time module &lt;/A&gt;is odd in that most of its functionality isn't documented at all, like the FormatDate method that has no references in the Desktop documentation except one to the old AML FORMATDATE function.&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Jun 2016 18:44:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/need-help-getting-year-from-a-date-field-field/m-p/269364#M20754</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2016-06-03T18:44:29Z</dc:date>
    </item>
    <item>
      <title>Re: Need help getting year from a date field (field calculator)</title>
      <link>https://community.esri.com/t5/python-questions/need-help-getting-year-from-a-date-field-field/m-p/269365#M20755</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A href="https://community.esri.com/migrated-users/6534"&gt;Robert Blash&lt;/A&gt;​, this "question" was created as a Discussion instead of a Question.&amp;nbsp; For future reference, it is best to mark questions as questions so people know you are seeking help instead of just sharing information.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Jun 2016 18:46:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/need-help-getting-year-from-a-date-field-field/m-p/269365#M20755</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2016-06-03T18:46:07Z</dc:date>
    </item>
    <item>
      <title>Re: Need help getting year from a date field (field calculator)</title>
      <link>https://community.esri.com/t5/python-questions/need-help-getting-year-from-a-date-field-field/m-p/269366#M20756</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Makes sense, thanks for the tip. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Jun 2016 18:51:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/need-help-getting-year-from-a-date-field-field/m-p/269366#M20756</guid>
      <dc:creator>RobBlash</dc:creator>
      <dc:date>2016-06-03T18:51:57Z</dc:date>
    </item>
    <item>
      <title>Re: Need help getting year from a date field (field calculator)</title>
      <link>https://community.esri.com/t5/python-questions/need-help-getting-year-from-a-date-field-field/m-p/269367#M20757</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for mentioning this. I had found the documentation page you linked above, and I wondered why there wasn't a reference to .FormatDate()&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How would you grade arcpy documentation overall? While I'm learning more and more about python I anticipate some head scratching along the way, which is of course minimized by good documentation. However, I didn't anticipate struggling so much to find this particular solution, after all finding DatePart('yyyy',[DateField]) is so much easier. I'm interested to hear the opinion of someone experienced.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Jun 2016 19:02:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/need-help-getting-year-from-a-date-field-field/m-p/269367#M20757</guid>
      <dc:creator>RobBlash</dc:creator>
      <dc:date>2016-06-03T19:02:56Z</dc:date>
    </item>
    <item>
      <title>Re: Need help getting year from a date field (field calculator)</title>
      <link>https://community.esri.com/t5/python-questions/need-help-getting-year-from-a-date-field-field/m-p/269368#M20758</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;lurking behind the time stuff... is the fact that esri hasn't move from python 2 to python 3 completely... so little things like time zone had to be added to the arcpy stuff.&amp;nbsp; However, when one makes the move, all will be good because it has been there for a while&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So if you aren't ready... &lt;A href="https://community.esri.com/thread/177766"&gt;python 2.7 countdown...&lt;/A&gt; &lt;/P&gt;&lt;P&gt;then you might want to look at this&lt;/P&gt;&lt;P&gt;&lt;A href="https://docs.python.org/3.5/library/datetime.html?highlight=datetime#module-datetime" title="https://docs.python.org/3.5/library/datetime.html?highlight=datetime#module-datetime"&gt;8.1. datetime — Basic date and time types — Python 3.5.1 documentation&lt;/A&gt;&lt;/P&gt;&lt;P&gt;don't let time go by&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Jun 2016 19:04:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/need-help-getting-year-from-a-date-field-field/m-p/269368#M20758</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2016-06-03T19:04:02Z</dc:date>
    </item>
    <item>
      <title>Re: Need help getting year from a date field (field calculator)</title>
      <link>https://community.esri.com/t5/python-questions/need-help-getting-year-from-a-date-field-field/m-p/269369#M20759</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I would rate the Python/ArcPy documentation as good, reaching towards very good.&amp;nbsp; The documentation is constantly improving, although different parts improve at different paces since different development teams work on their own Python documentation.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Jun 2016 19:48:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/need-help-getting-year-from-a-date-field-field/m-p/269369#M20759</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2016-06-03T19:48:53Z</dc:date>
    </item>
    <item>
      <title>Re: Need help getting year from a date field (field calculator)</title>
      <link>https://community.esri.com/t5/python-questions/need-help-getting-year-from-a-date-field-field/m-p/269370#M20760</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This was very helpful, the code allows you to replace 'yyyy' with "dddd" and "MMMM" to return days and months in string formats &lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Aug 2018 19:00:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/need-help-getting-year-from-a-date-field-field/m-p/269370#M20760</guid>
      <dc:creator>FernandoAlvarez1</dc:creator>
      <dc:date>2018-08-10T19:00:59Z</dc:date>
    </item>
    <item>
      <title>Re: Need help getting year from a date field (field calculator)</title>
      <link>https://community.esri.com/t5/python-questions/need-help-getting-year-from-a-date-field-field/m-p/1407718#M70281</link>
      <description>&lt;P&gt;!installdate!.year&lt;/P&gt;</description>
      <pubDate>Tue, 09 Apr 2024 20:29:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/need-help-getting-year-from-a-date-field-field/m-p/1407718#M70281</guid>
      <dc:creator>SanjaySinghNegi</dc:creator>
      <dc:date>2024-04-09T20:29:53Z</dc:date>
    </item>
    <item>
      <title>Re: Need help getting year from a date field (field calculator)</title>
      <link>https://community.esri.com/t5/python-questions/need-help-getting-year-from-a-date-field-field/m-p/1419778#M70533</link>
      <description>&lt;P&gt;thank you, it work on my case&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 07 May 2024 09:03:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/need-help-getting-year-from-a-date-field-field/m-p/1419778#M70533</guid>
      <dc:creator>TomyArdyansyah</dc:creator>
      <dc:date>2024-05-07T09:03:45Z</dc:date>
    </item>
  </channel>
</rss>

