<?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 How to calculate date difference using Current_Date in ArcGIS Online Questions</title>
    <link>https://community.esri.com/t5/arcgis-online-questions/how-to-calculate-date-difference-using-current/m-p/231657#M11356</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello.&lt;/P&gt;&lt;P&gt;I am working with an&amp;nbsp;AGOL hosted feature layer. &amp;nbsp;I am trying to calc the difference between when a record was added and the current date.&lt;/P&gt;&lt;P&gt;I am using the 'calculate' function that is available by clicking in the 'gear' icon that appears in the upper right corner of a column header. &amp;nbsp;&lt;/P&gt;&lt;P&gt;The expression i am using is &amp;nbsp;'AgeInDays = CURRENT_DATE() - DateReceived'. That expression successfully validates.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When i click the 'Calculate' button, i get the following error message:&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;&lt;SPAN style="color: #444444; background-color: #d2e959; font-size: 12px;"&gt;Calculate for the expression 'CURRENT_DATE() - DateReceived' failed.&lt;/SPAN&gt;&lt;BR style="color: #444444; background-color: #d2e959; font-size: 12px;" /&gt;&lt;SPAN style="color: #444444; background-color: #d2e959; font-size: 12px;"&gt;Implicit conversion from data type datetime to float is not allowed. Use the CONVERT function to run this query.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;I have tried various forms of the CONVERT function as suggested by the error message, but i haven't stumbled upon the correct syntax.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any idea why that expression is not working. My reading of the 'working with fields' documentation suggests that the number of days should be returned. In fact when i use two date fields from the table in the expression (rather than CURRENT_DATE), the number of days is returned. &amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there something special i need to do to use 'CURRENT_DATE'?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any suggestions on how to use CURRENT_DATE to get the difference between two dates?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 03 Nov 2016 18:14:10 GMT</pubDate>
    <dc:creator>TomRippetoe</dc:creator>
    <dc:date>2016-11-03T18:14:10Z</dc:date>
    <item>
      <title>How to calculate date difference using Current_Date</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/how-to-calculate-date-difference-using-current/m-p/231657#M11356</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello.&lt;/P&gt;&lt;P&gt;I am working with an&amp;nbsp;AGOL hosted feature layer. &amp;nbsp;I am trying to calc the difference between when a record was added and the current date.&lt;/P&gt;&lt;P&gt;I am using the 'calculate' function that is available by clicking in the 'gear' icon that appears in the upper right corner of a column header. &amp;nbsp;&lt;/P&gt;&lt;P&gt;The expression i am using is &amp;nbsp;'AgeInDays = CURRENT_DATE() - DateReceived'. That expression successfully validates.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When i click the 'Calculate' button, i get the following error message:&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;&lt;SPAN style="color: #444444; background-color: #d2e959; font-size: 12px;"&gt;Calculate for the expression 'CURRENT_DATE() - DateReceived' failed.&lt;/SPAN&gt;&lt;BR style="color: #444444; background-color: #d2e959; font-size: 12px;" /&gt;&lt;SPAN style="color: #444444; background-color: #d2e959; font-size: 12px;"&gt;Implicit conversion from data type datetime to float is not allowed. Use the CONVERT function to run this query.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;I have tried various forms of the CONVERT function as suggested by the error message, but i haven't stumbled upon the correct syntax.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any idea why that expression is not working. My reading of the 'working with fields' documentation suggests that the number of days should be returned. In fact when i use two date fields from the table in the expression (rather than CURRENT_DATE), the number of days is returned. &amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there something special i need to do to use 'CURRENT_DATE'?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any suggestions on how to use CURRENT_DATE to get the difference between two dates?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 Nov 2016 18:14:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/how-to-calculate-date-difference-using-current/m-p/231657#M11356</guid>
      <dc:creator>TomRippetoe</dc:creator>
      <dc:date>2016-11-03T18:14:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate date difference using Current_Date</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/how-to-calculate-date-difference-using-current/m-p/231658#M11357</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Tom,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This looks like a bug. It's specific to using the CURRENT_DATE (or _TIME, _TIMESTAMP) function. To use the current date, you'll need to use a date literal, like DATE'11/04/2016' or&amp;nbsp;&lt;SPAN&gt;DATE'11/04/2016 5:00PM'. Edit: you could also create a dummy date field and calculate the field to use CURRENT_DATE and then perform the calculation on your number field using the date field storing CURRENT_DATE (the dummy field could be removed after).&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;The bug has been logged internally and expected to be fixed in the next ArcGIS Online release (currently planned for December). Feel free to contact Tech Support if you'd like a public facing bug logged.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Chris&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;ArcGIS Online team&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 04 Nov 2016 16:12:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/how-to-calculate-date-difference-using-current/m-p/231658#M11357</guid>
      <dc:creator>ChrisWhitmore</dc:creator>
      <dc:date>2016-11-04T16:12:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate date difference using Current_Date</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/how-to-calculate-date-difference-using-current/m-p/231659#M11358</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for the info Chris.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 04 Nov 2016 17:04:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/how-to-calculate-date-difference-using-current/m-p/231659#M11358</guid>
      <dc:creator>TomRippetoe</dc:creator>
      <dc:date>2016-11-04T17:04:04Z</dc:date>
    </item>
  </channel>
</rss>

