<?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: Format time calculation with hours and minutes in ArcGIS Survey123 Questions</title>
    <link>https://community.esri.com/t5/arcgis-survey123-questions/format-time-calculation-with-hours-and-minutes/m-p/1276142#M48461</link>
    <description>&lt;P&gt;&lt;SPAN&gt;Hello James. Just like the anon below, I used the same syntax you provided,&amp;nbsp;and it works great on the survey 123 app but not on the browser form. I need it to work on the browser form because that is how we plan to distribute our form. Do you know what I can do to make it work for browser?&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 06 Apr 2023 13:06:33 GMT</pubDate>
    <dc:creator>SamanthaJordan</dc:creator>
    <dc:date>2023-04-06T13:06:33Z</dc:date>
    <item>
      <title>Format time calculation with hours and minutes</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/format-time-calculation-with-hours-and-minutes/m-p/810826#M13226</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Is there an easy way to calculate a duration from start to end displayed in hours &lt;STRONG&gt;and&lt;/STRONG&gt; minutes?&amp;nbsp; I've only seen mention of either/or. I've tried a few things unsuccessfully.&amp;nbsp; Essentially I just want ${EndTime} - ${StartTime} in a h:mm format.&amp;nbsp; So, if I have StartTime = 12:00PM and EndTime = 2:06PM, I want Duration to be 2:06, not 2.1 hours or 126 minutes.&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Nov 2017 15:58:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/format-time-calculation-with-hours-and-minutes/m-p/810826#M13226</guid>
      <dc:creator>bshepard</dc:creator>
      <dc:date>2017-11-09T15:58:19Z</dc:date>
    </item>
    <item>
      <title>Re: Format time calculation with hours and minutes</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/format-time-calculation-with-hours-and-minutes/m-p/810827#M13227</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Brian,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is pretty straightforward if a little tedious. &amp;nbsp;First to note is that time is stored internally in the Survey123 app in milliseconds (ms). &amp;nbsp;1000 ms = 1 sec = 1/60 min = 1/3600 hr. &amp;nbsp;This leads to:&lt;/P&gt;&lt;P&gt;# of hours = &lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;time elapsed / (3600*1000)&lt;/SPAN&gt; &amp;gt; take the integer of the result&lt;/P&gt;&lt;P&gt;# of minutes (total) = &lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;time elapsed / (60*1000)&lt;/SPAN&gt; &amp;gt; then use the modulo operation with 60 (&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;mod 60&lt;/SPAN&gt;) to get the number of minutes under a whole hour&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A small thing to remember visually is to pad a zero if the number of minutes is less than 10&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The Excel sheet attached steps through the formulas; all together the function (assuming the end question is t2 and the start question is t1:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;concat(int((${t2} - ${t1}) div (1000*60*60)), ":", if(int(((${t2} - ${t1}) div (1000*60)) mod 60) &amp;lt; 10,"0",""), int(((${t2} - ${t1}) div (1000*60)) mod 60))&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Nov 2017 19:23:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/format-time-calculation-with-hours-and-minutes/m-p/810827#M13227</guid>
      <dc:creator>JamesTedrick</dc:creator>
      <dc:date>2017-11-09T19:23:23Z</dc:date>
    </item>
    <item>
      <title>Re: Format time calculation with hours and minutes</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/format-time-calculation-with-hours-and-minutes/m-p/810828#M13228</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for you reply James.&amp;nbsp; After having time to work through your spreadsheet, I realized that the calculations were step wise and not additive.&amp;nbsp; The single calculation on the last row is all I needed.&amp;nbsp; I appreciate your help.&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Nov 2017 21:41:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/format-time-calculation-with-hours-and-minutes/m-p/810828#M13228</guid>
      <dc:creator>bshepard</dc:creator>
      <dc:date>2017-11-09T21:41:27Z</dc:date>
    </item>
    <item>
      <title>Re: Format time calculation with hours and minutes</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/format-time-calculation-with-hours-and-minutes/m-p/810829#M13229</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;No worries. &amp;nbsp;If you happen to be on UTC time, this can be simplified to t2-t1 - that represents the total number of milliseconds since midnight UTC and can be used in the format-date function (you could then add/subtract the UTC offset, though this would break for times lasting longer than 24 hours).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Nov 2017 18:19:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/format-time-calculation-with-hours-and-minutes/m-p/810829#M13229</guid>
      <dc:creator>JamesTedrick</dc:creator>
      <dc:date>2017-11-10T18:19:12Z</dc:date>
    </item>
    <item>
      <title>Re: Format time calculation with hours and minutes</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/format-time-calculation-with-hours-and-minutes/m-p/810830#M13230</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I just updated my calculations to use Decimal Time, based on the blog post here:&amp;nbsp;&lt;A href="https://community.esri.com/groups/survey123/blog/2016/04/17/dates-and-time-in-survey123-for-arcgis"&gt;https://community.esri.com/groups/survey123/blog/2016/04/17/dates-and-time-in-survey123-for-arcgis&lt;/A&gt;. Occasionally the calculation is 1 minute off.&amp;nbsp; When there's a 1 hour difference the Unix Time calculation correctly shows 1 hour, the Decimal Time calculation shows 59 minutes.&amp;nbsp;Any suggestions?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here's my new calculation:&amp;nbsp;concat(int((decimal-date-time(${EventEndTime}) - decimal-date-time(${EventStartTime})) * 24), ":", if(int((((decimal-date-time(${EventEndTime}) - decimal-date-time(${EventStartTime})) * (24*60))) mod 60) &amp;lt; 10,"0",""), int(((decimal-date-time(${EventEndTime}) - decimal-date-time(${EventStartTime})) * (24*60)) mod 60))&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 05 Mar 2018 19:19:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/format-time-calculation-with-hours-and-minutes/m-p/810830#M13230</guid>
      <dc:creator>bshepard</dc:creator>
      <dc:date>2018-03-05T19:19:59Z</dc:date>
    </item>
    <item>
      <title>Re: Format time calculation with hours and minutes</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/format-time-calculation-with-hours-and-minutes/m-p/810831#M13231</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Moving the hour/minute calculations into the start and end time fixed the issue.&amp;nbsp; Thanks for the suggestion at the Dev Summit, James.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;concat(int((decimal-date-time(${EventEndTime} * 24) - decimal-date-time(${EventStartTime} * 24))), ":", if(int((((decimal-date-time(${EventEndTime} * 24 * 60) - decimal-date-time(${EventStartTime} * 24 * 60)))) mod 60) &amp;lt; 10,"0",""), int(((decimal-date-time(${EventEndTime} * 24 * 60) - decimal-date-time(${EventStartTime} * 24 * 60))) mod 60))&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 16 Mar 2018 22:02:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/format-time-calculation-with-hours-and-minutes/m-p/810831#M13231</guid>
      <dc:creator>bshepard</dc:creator>
      <dc:date>2018-03-16T22:02:26Z</dc:date>
    </item>
    <item>
      <title>Re: Format time calculation with hours and minutes</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/format-time-calculation-with-hours-and-minutes/m-p/810832#M13232</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello &lt;A href="https://community.esri.com/migrated-users/3263"&gt;James Tedrick&lt;/A&gt;‌&lt;BR /&gt;&lt;BR /&gt;Is it possible to calculate the hours and minutes for more than 24 hours. I tried the excel sheet you've attached here, but when fill for example (2:47 PM as start and 12:32 AM as end) this will give a minus value. I wanted to know if it's possible to get values more than 24 like 50:45 as summation.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance,&lt;/P&gt;&lt;P&gt;Khalil&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 Aug 2019 11:53:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/format-time-calculation-with-hours-and-minutes/m-p/810832#M13232</guid>
      <dc:creator>khalilramadeen</dc:creator>
      <dc:date>2019-08-08T11:53:24Z</dc:date>
    </item>
    <item>
      <title>Re: Format time calculation with hours and minutes</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/format-time-calculation-with-hours-and-minutes/m-p/810833#M13233</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Khalil,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You would need to use datetime question to get the appropriate value, they should automatically account for the extra days.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Aug 2019 16:54:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/format-time-calculation-with-hours-and-minutes/m-p/810833#M13233</guid>
      <dc:creator>JamesTedrick</dc:creator>
      <dc:date>2019-08-09T16:54:43Z</dc:date>
    </item>
    <item>
      <title>Re: Format time calculation with hours and minutes</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/format-time-calculation-with-hours-and-minutes/m-p/810834#M13234</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This was just what I was looking for!&amp;nbsp; Thanks James!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Just one question how do I get it to calculate part hours eg 1.5?&amp;nbsp; this just seems to give the answer in whole hours&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Sep 2019 04:32:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/format-time-calculation-with-hours-and-minutes/m-p/810834#M13234</guid>
      <dc:creator>ChrisRoberts2</dc:creator>
      <dc:date>2019-09-03T04:32:13Z</dc:date>
    </item>
    <item>
      <title>Re: Format time calculation with hours and minutes</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/format-time-calculation-with-hours-and-minutes/m-p/1003519#M31232</link>
      <description>&lt;P&gt;I've followed this format and this process works in the Connect app but when testing this from a browser I get a NaN:NaN for the result, which I believe is "not a number". I'm not sure what I'm missing as in the sample spreadsheet those fields were all notes, so where is it getting confused in the process that the result is not a number? Or why is it looking for a number if the field is a note/string?&lt;/P&gt;</description>
      <pubDate>Fri, 20 Nov 2020 16:47:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/format-time-calculation-with-hours-and-minutes/m-p/1003519#M31232</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2020-11-20T16:47:15Z</dc:date>
    </item>
    <item>
      <title>Re: Format time calculation with hours and minutes</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/format-time-calculation-with-hours-and-minutes/m-p/1276140#M48460</link>
      <description>&lt;P&gt;Did you solve why it did that for the browser only? I am having the same issue?&lt;/P&gt;</description>
      <pubDate>Thu, 06 Apr 2023 13:04:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/format-time-calculation-with-hours-and-minutes/m-p/1276140#M48460</guid>
      <dc:creator>SamanthaJordan</dc:creator>
      <dc:date>2023-04-06T13:04:30Z</dc:date>
    </item>
    <item>
      <title>Re: Format time calculation with hours and minutes</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/format-time-calculation-with-hours-and-minutes/m-p/1276142#M48461</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Hello James. Just like the anon below, I used the same syntax you provided,&amp;nbsp;and it works great on the survey 123 app but not on the browser form. I need it to work on the browser form because that is how we plan to distribute our form. Do you know what I can do to make it work for browser?&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 06 Apr 2023 13:06:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/format-time-calculation-with-hours-and-minutes/m-p/1276142#M48461</guid>
      <dc:creator>SamanthaJordan</dc:creator>
      <dc:date>2023-04-06T13:06:33Z</dc:date>
    </item>
    <item>
      <title>Re: Format time calculation with hours and minutes</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/format-time-calculation-with-hours-and-minutes/m-p/1589068#M61393</link>
      <description>&lt;P&gt;Hi James-&lt;/P&gt;&lt;P&gt;I am a real&amp;nbsp; rookie using Survey 123 and especially the calculations (but I am not giving up)!&lt;/P&gt;&lt;P&gt;I used your formula to calculate and output hours and minutes:&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;concat(int((${t2} - ${t1}) div (1000*60*60)), ":", if(int(((${t2} - ${t1}) div (1000*60)) mod 60) &amp;lt; 10,"0",""), int(((${t2} - ${t1}) div (1000*60)) mod 60))&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;However, I don't know how to show the colon between the hours and minutes after running the form.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanks.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 25 Feb 2025 18:20:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/format-time-calculation-with-hours-and-minutes/m-p/1589068#M61393</guid>
      <dc:creator>SueBoelk2</dc:creator>
      <dc:date>2025-02-25T18:20:23Z</dc:date>
    </item>
  </channel>
</rss>

