<?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 time between two date-times using a date formatted from a pulldata question in ArcGIS Survey123 Questions</title>
    <link>https://community.esri.com/t5/arcgis-survey123-questions/calculate-time-between-two-date-times-using-a-date/m-p/1380845#M54695</link>
    <description>&lt;P&gt;All dates and times in S123 are captures in as a Unix Time Stamp.&lt;/P&gt;&lt;P&gt;All calculations (e.g., determining difference between two dates/times) needs to be done in Unix Time.&lt;/P&gt;&lt;P&gt;Whatever is captured in a &lt;EM&gt;date&lt;/EM&gt; or &lt;EM&gt;dateTime&lt;/EM&gt; question will print out as a "human date" in Feature Reports automatically.&lt;/P&gt;&lt;P&gt;If you want to display a captured date/time somewhere else in S123 (such as the instance_name, or display the result of a calculate) you will need to use &lt;A href="https://community.esri.com/t5/arcgis-survey123-blog/dates-and-time-in-survey123/ba-p/895528" target="_self"&gt;&lt;STRONG&gt;format-date()&lt;/STRONG&gt; or &lt;STRONG&gt;format-time()&lt;/STRONG&gt;&lt;/A&gt; first.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;hh:mm:ss&lt;/STRONG&gt; = &lt;STRONG&gt;format-time(${your_question},'%H:%M:%S')&lt;/STRONG&gt;&lt;/P&gt;</description>
    <pubDate>Sun, 11 Feb 2024 15:33:44 GMT</pubDate>
    <dc:creator>abureaux</dc:creator>
    <dc:date>2024-02-11T15:33:44Z</dc:date>
    <item>
      <title>Calculate time between two date-times using a date formatted from a pulldata question</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/calculate-time-between-two-date-times-using-a-date/m-p/1368940#M53916</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I would like to calculate the hours (in decimal time) between the current inspection date/time and the previous inspection date/time.&amp;nbsp; I am using the pulldata function to recall the last inspection date/time and the now() function to populate the date/time of the current inspection, but when I try to calculate the time between the two dates I get an validation error message.&amp;nbsp; I think (but really I'm just guessing) the pulldata function is inserting the previous date/time as a string in epoch time and I can't figure out what the calculation formula should be?&amp;nbsp; Below is a copy of my form.&amp;nbsp; Any help would be appreciated!!&lt;/P&gt;&lt;TABLE border="1" width="100%"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="16.666666666666668%" height="40px"&gt;type&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="40px"&gt;name&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="40px"&gt;&lt;P&gt;calculation&lt;/P&gt;&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="40px"&gt;bind::Type&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="40px"&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="40px"&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="16.666666666666668%" height="40px"&gt;dateTime&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="40px"&gt;DateTime&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="40px"&gt;&lt;P&gt;now()&lt;/P&gt;&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="40px"&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="40px"&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="40px"&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="16.666666666666668%" height="47px"&gt;note&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="47px"&gt;dateTimePrevious&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="47px"&gt;'pulldata("@layer","getValue","attributes.DateTime","&lt;A href="https://services2.arcgis.com/lIdP1KS6Ves6C693/arcgis/rest/services/service_85b98d8810d94245a64f30d3a6dc10ef/FeatureServer/0?orderByFields=DateTime" target="_blank"&gt;https://services2.arcgis.com/lIdP1KS6Ves6C693/arcgis/rest/services/service_85b98d8810d94245a64f30d3a6dc10ef/FeatureServer/0?orderByFields=DateTime&lt;/A&gt; DESC", ${WhereClauseFacID})&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="47px"&gt;&lt;P&gt;decimal&lt;/P&gt;&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="47px"&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="47px"&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="16.666666666666668%" height="40px"&gt;note&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="40px"&gt;Duration&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="40px"&gt;&lt;P&gt;(decimal-date-time(${dateTimePrevious}) - decimal-date-time(${DateTime}))&lt;/P&gt;&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="40px"&gt;decimal&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="40px"&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="40px"&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 11 Jan 2024 15:21:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/calculate-time-between-two-date-times-using-a-date/m-p/1368940#M53916</guid>
      <dc:creator>LeslieO_Hare2</dc:creator>
      <dc:date>2024-01-11T15:21:19Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate time between two date-times using a date formatted from a pulldata question</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/calculate-time-between-two-date-times-using-a-date/m-p/1369230#M53940</link>
      <description>&lt;P&gt;Have you tried putting the pulldata into a text field to see what format it's pulling? If you are pulling from a dateTime field and dumping that value into a dateTime field, I feel like it should work.&lt;/P&gt;&lt;P&gt;Regarding the time difference, I'm not sure I understand. Do you just want the number of hours between two dates? That is relatively simple:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="abureaux_1-1705010175589.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/91319i9FEF0CD799ACF1B4/image-size/medium?v=v2&amp;amp;px=400" role="button" title="abureaux_1-1705010175589.png" alt="abureaux_1-1705010175589.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="abureaux_2-1705010195722.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/91320iA40360430DEEA25B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="abureaux_2-1705010195722.png" alt="abureaux_2-1705010195722.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You will want some type of rounding on this otherwise you will end up with a very small decimal due to the slight differences in time. E.g.:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="abureaux_3-1705010261073.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/91321iA62E40BA0E827B53/image-size/medium?v=v2&amp;amp;px=400" role="button" title="abureaux_3-1705010261073.png" alt="abureaux_3-1705010261073.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 11 Jan 2024 21:58:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/calculate-time-between-two-date-times-using-a-date/m-p/1369230#M53940</guid>
      <dc:creator>abureaux</dc:creator>
      <dc:date>2024-01-11T21:58:03Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate time between two date-times using a date formatted from a pulldata question</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/calculate-time-between-two-date-times-using-a-date/m-p/1371019#M54041</link>
      <description>&lt;P&gt;Thank you, that worked!&amp;nbsp; I previously changed the field type to DateTime, but I think I just had the calculation incorrect.&lt;/P&gt;</description>
      <pubDate>Wed, 17 Jan 2024 15:52:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/calculate-time-between-two-date-times-using-a-date/m-p/1371019#M54041</guid>
      <dc:creator>LeslieO_Hare2</dc:creator>
      <dc:date>2024-01-17T15:52:31Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate time between two date-times using a date formatted from a pulldata question</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/calculate-time-between-two-date-times-using-a-date/m-p/1380803#M54694</link>
      <description>&lt;P&gt;How to capture time input format&amp;nbsp; hh:mm:ss. and do calculations in survey forms for example&amp;nbsp; start time as hh:mm:ss and End time as hh:mm:ss. then report the time difference in minutes and seconds in a text box. I was able to display the difference in minutes as follows.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SusanMathai_3-1707631663579.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/94421iEEB79EA9847BEC1C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="SusanMathai_3-1707631663579.png" alt="SusanMathai_3-1707631663579.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 11 Feb 2024 06:08:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/calculate-time-between-two-date-times-using-a-date/m-p/1380803#M54694</guid>
      <dc:creator>SusanMathai</dc:creator>
      <dc:date>2024-02-11T06:08:05Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate time between two date-times using a date formatted from a pulldata question</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/calculate-time-between-two-date-times-using-a-date/m-p/1380845#M54695</link>
      <description>&lt;P&gt;All dates and times in S123 are captures in as a Unix Time Stamp.&lt;/P&gt;&lt;P&gt;All calculations (e.g., determining difference between two dates/times) needs to be done in Unix Time.&lt;/P&gt;&lt;P&gt;Whatever is captured in a &lt;EM&gt;date&lt;/EM&gt; or &lt;EM&gt;dateTime&lt;/EM&gt; question will print out as a "human date" in Feature Reports automatically.&lt;/P&gt;&lt;P&gt;If you want to display a captured date/time somewhere else in S123 (such as the instance_name, or display the result of a calculate) you will need to use &lt;A href="https://community.esri.com/t5/arcgis-survey123-blog/dates-and-time-in-survey123/ba-p/895528" target="_self"&gt;&lt;STRONG&gt;format-date()&lt;/STRONG&gt; or &lt;STRONG&gt;format-time()&lt;/STRONG&gt;&lt;/A&gt; first.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;hh:mm:ss&lt;/STRONG&gt; = &lt;STRONG&gt;format-time(${your_question},'%H:%M:%S')&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 11 Feb 2024 15:33:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/calculate-time-between-two-date-times-using-a-date/m-p/1380845#M54695</guid>
      <dc:creator>abureaux</dc:creator>
      <dc:date>2024-02-11T15:33:44Z</dc:date>
    </item>
  </channel>
</rss>

