<?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 difference in ArcMap in Geoprocessing Questions</title>
    <link>https://community.esri.com/t5/geoprocessing-questions/calculate-date-difference-in-arcmap/m-p/184489#M6208</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You will access the system date in your calculation and use the DateDiff function.&amp;nbsp; The syntax will depend on the underlying data source, Oracle, SQL Server, etc..&amp;nbsp; Example:&amp;nbsp; &lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif; background-color: #f6f6f6;"&gt;DATEDIFF(day, date_col ,SYSDATETIME()) &amp;lt; 90. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A _jive_internal="true" href="https://community.esri.com/message/192151#192151"&gt;I found the answer in this post&lt;/A&gt;&amp;nbsp; by &lt;A href="https://community.esri.com/migrated-users/3051"&gt;Vince Angelo&lt;/A&gt;‌&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;ArcSDE supports five different RDBMSes that use SQL, all of which have different syntax&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;for referring to dates and date functions. Even using just Microsoft SQL-Server, there&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;are multiple possible flavors (2005, 2008, 2008R2). Dates can also be difficult due to&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;variability of precision -- does a time reference to a day without hour imply midnight&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;or noon, and in what timezone?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;What you're looking for probably involves the SYSDATETIME() function and some variant&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;of DATEADD or DATEDIFF --&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;where date_col &amp;gt; DATEADD(day,-7,SYSDATETIME())&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;or &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;where DATEDIFF(day,date_col,SYSDATETIME()) &amp;lt; 7&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;but that depends on the exact types involved. This &lt;/SPAN&gt;&lt;A rel="nofollow" style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif; color: #287433;"&gt;documentation page&lt;/A&gt;&lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt; is probably a&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;good starting point, but you'll likely need to experiment, since different variants of the&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;same expression are likely to give different performance, depending on how the index&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;interacts with the expression.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;- V&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.2/index.html#//00s500000033000000" title="http://resources.arcgis.com/en/help/main/10.2/index.html#//00s500000033000000"&gt;ArcGIS Help on SQL Query (10.2, 10.2.1, and 10.2.2)&lt;/A&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 04 Dec 2014 16:24:54 GMT</pubDate>
    <dc:creator>LangdonSanders2</dc:creator>
    <dc:date>2014-12-04T16:24:54Z</dc:date>
    <item>
      <title>Calculate date difference in ArcMap</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/calculate-date-difference-in-arcmap/m-p/184488#M6207</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can I calculate the difference between today and a date field in ArcMap in days.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to select all the records that were created during the last 90 days.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Dec 2014 15:56:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/calculate-date-difference-in-arcmap/m-p/184488#M6207</guid>
      <dc:creator>JoseSanchez</dc:creator>
      <dc:date>2014-12-04T15:56:59Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate date difference in ArcMap</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/calculate-date-difference-in-arcmap/m-p/184489#M6208</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You will access the system date in your calculation and use the DateDiff function.&amp;nbsp; The syntax will depend on the underlying data source, Oracle, SQL Server, etc..&amp;nbsp; Example:&amp;nbsp; &lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif; background-color: #f6f6f6;"&gt;DATEDIFF(day, date_col ,SYSDATETIME()) &amp;lt; 90. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A _jive_internal="true" href="https://community.esri.com/message/192151#192151"&gt;I found the answer in this post&lt;/A&gt;&amp;nbsp; by &lt;A href="https://community.esri.com/migrated-users/3051"&gt;Vince Angelo&lt;/A&gt;‌&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;ArcSDE supports five different RDBMSes that use SQL, all of which have different syntax&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;for referring to dates and date functions. Even using just Microsoft SQL-Server, there&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;are multiple possible flavors (2005, 2008, 2008R2). Dates can also be difficult due to&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;variability of precision -- does a time reference to a day without hour imply midnight&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;or noon, and in what timezone?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;What you're looking for probably involves the SYSDATETIME() function and some variant&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;of DATEADD or DATEDIFF --&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;where date_col &amp;gt; DATEADD(day,-7,SYSDATETIME())&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;or &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;where DATEDIFF(day,date_col,SYSDATETIME()) &amp;lt; 7&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;but that depends on the exact types involved. This &lt;/SPAN&gt;&lt;A rel="nofollow" style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif; color: #287433;"&gt;documentation page&lt;/A&gt;&lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt; is probably a&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;good starting point, but you'll likely need to experiment, since different variants of the&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;same expression are likely to give different performance, depending on how the index&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;interacts with the expression.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;- V&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.2/index.html#//00s500000033000000" title="http://resources.arcgis.com/en/help/main/10.2/index.html#//00s500000033000000"&gt;ArcGIS Help on SQL Query (10.2, 10.2.1, and 10.2.2)&lt;/A&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Dec 2014 16:24:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/calculate-date-difference-in-arcmap/m-p/184489#M6208</guid>
      <dc:creator>LangdonSanders2</dc:creator>
      <dc:date>2014-12-04T16:24:54Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate date difference in ArcMap</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/calculate-date-difference-in-arcmap/m-p/184490#M6209</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I updated the invalid link in the original post so it goes to the intended page:&lt;/P&gt;&lt;P&gt;&lt;A href="http://msdn.microsoft.com/en-us/library/ms186724.aspx" title="http://msdn.microsoft.com/en-us/library/ms186724.aspx"&gt;Date and Time Data Types and Functions (Transact-SQL)&lt;/A&gt;&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Dec 2014 16:35:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/calculate-date-difference-in-arcmap/m-p/184490#M6209</guid>
      <dc:creator>VinceAngelo</dc:creator>
      <dc:date>2014-12-04T16:35:52Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate date difference in ArcMap</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/calculate-date-difference-in-arcmap/m-p/184491#M6210</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The answer is very simple:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;MY_FIELD_DATE &amp;lt; CURRENT_DATE - 90&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A _jive_internal="true" href="https://community.esri.com/message/442826?et=watches.email.thread#442826" title="https://community.esri.com/message/442826?et=watches.email.thread#442826"&gt;https://community.esri.com/message/442826?et=watches.email.thread#442826&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Dec 2014 18:05:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/calculate-date-difference-in-arcmap/m-p/184491#M6210</guid>
      <dc:creator>JoseSanchez</dc:creator>
      <dc:date>2014-12-04T18:05:06Z</dc:date>
    </item>
  </channel>
</rss>

