<?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: survey123 Date calculation using 12 hour day in ArcGIS Survey123 Questions</title>
    <link>https://community.esri.com/t5/arcgis-survey123-questions/survey123-date-calculation-using-12-hour-day/m-p/771151#M3795</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Tim,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To resolve this I would suggest you need to add more logic into the first part of your calculation, where you minus the start time from finish time. This is where you need to adjust for if the day is different.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My initial thoughts are you could do this with an if statement. So if the&amp;nbsp;day/date&amp;nbsp;is the same for start/finish then simply minus start from finish, but if the&amp;nbsp;&lt;SPAN&gt;day/date&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;is&amp;nbsp;not the same for start/finish then you need to calculate the time for the first day (ie likely 12 hours but may not be) and then calculate&amp;nbsp;the time for the second day, then add them together to get a total over the two days. This can be done in one if statement in the first part of your calculation, or put it separate&amp;nbsp;in other hidden/null questions, and then do the calculation&amp;nbsp;to to convert to hours.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Regards,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Phil.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 27 Jul 2020 02:32:58 GMT</pubDate>
    <dc:creator>Anonymous User</dc:creator>
    <dc:date>2020-07-27T02:32:58Z</dc:date>
    <item>
      <title>survey123 Date calculation using 12 hour day</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/survey123-date-calculation-using-12-hour-day/m-p/771150#M3794</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am trying work out if it's possible to calculate the 'processing time' we perform during our work day which is 12 hours.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Currently I have questions set up like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;START_TIME (datetime)&lt;/P&gt;&lt;P&gt;FINISH_TIME (datetime)&lt;/P&gt;&lt;P&gt;DOWNTIME_HRS (decimal)&lt;/P&gt;&lt;P&gt;RUNTIME_HRS (decimal)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The current calculation i have set up is this:&lt;/P&gt;&lt;P&gt;RUNTIME_HRS&amp;nbsp; =&amp;nbsp; int(${FINISH_TIME} - ${START_TIME}) div (1000*60*60) - ${DOWNTIME_HRS}&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This works on a 24 hour clock, but doesn't give a true indication of the runtime of the processing as it only operates for 12 hours. So I get incorrect answers if the processing is over 2 days.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For instance, if we are half-way thru processing&amp;nbsp;we will stop at the end of the work day (12 hours), then re-start the next day.&lt;/P&gt;&lt;P&gt;Any idea how I could capture this in the calculation?&lt;/P&gt;&lt;P&gt;Basically looking for a 12 hour day rather than 24 hours.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Jul 2020 08:16:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/survey123-date-calculation-using-12-hour-day/m-p/771150#M3794</guid>
      <dc:creator>timdunlevie</dc:creator>
      <dc:date>2020-07-24T08:16:39Z</dc:date>
    </item>
    <item>
      <title>Re: survey123 Date calculation using 12 hour day</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/survey123-date-calculation-using-12-hour-day/m-p/771151#M3795</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Tim,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To resolve this I would suggest you need to add more logic into the first part of your calculation, where you minus the start time from finish time. This is where you need to adjust for if the day is different.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My initial thoughts are you could do this with an if statement. So if the&amp;nbsp;day/date&amp;nbsp;is the same for start/finish then simply minus start from finish, but if the&amp;nbsp;&lt;SPAN&gt;day/date&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;is&amp;nbsp;not the same for start/finish then you need to calculate the time for the first day (ie likely 12 hours but may not be) and then calculate&amp;nbsp;the time for the second day, then add them together to get a total over the two days. This can be done in one if statement in the first part of your calculation, or put it separate&amp;nbsp;in other hidden/null questions, and then do the calculation&amp;nbsp;to to convert to hours.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Regards,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Phil.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 27 Jul 2020 02:32:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/survey123-date-calculation-using-12-hour-day/m-p/771151#M3795</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2020-07-27T02:32:58Z</dc:date>
    </item>
    <item>
      <title>Re: survey123 Date calculation using 12 hour day</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/survey123-date-calculation-using-12-hour-day/m-p/771152#M3796</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Philip.&lt;/P&gt;&lt;P&gt;So what I am playing with is this:&lt;/P&gt;&lt;P&gt;START_DAY: format-date(${START_TIME},'%e') - which gives me an integer for the start DAY&lt;/P&gt;&lt;P&gt;FINISH_DAY: format-date(${FINISH_TIME},'%e') - which gives me an integer for ending DAY&lt;/P&gt;&lt;P&gt;then,&lt;/P&gt;&lt;P&gt;if(${START_DAY} = ${FINISH_DAY},int(${FINISH_TIME} - ${START_TIME}) div (1000*60*60) - ${DOWNTIME_HRS},if(${FINISH_DAY} - ${START_DAY} = 1,int(${FINISH_TIME} - ${START_TIME}) div (1000*60*60) -12 - ${DOWNTIME_HRS}))....and so on depending on the equation FINISH_DAY - START_DAY&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This doesn't work though if the dates go from 31st July to the 1st August.&lt;/P&gt;&lt;P&gt;Is there a format-date calc that will give me a whole number for a 'date' ?&lt;/P&gt;&lt;P&gt;e.g. can I convert 31/07/2020 to a 'number' ?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 27 Jul 2020 06:45:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/survey123-date-calculation-using-12-hour-day/m-p/771152#M3796</guid>
      <dc:creator>timdunlevie</dc:creator>
      <dc:date>2020-07-27T06:45:32Z</dc:date>
    </item>
    <item>
      <title>Re: survey123 Date calculation using 12 hour day</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/survey123-date-calculation-using-12-hour-day/m-p/771153#M3797</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Tim,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Looks like you are on the right track, but the change over to a new month may cause an issue based on how you have done your calculation. I am not aware if a format-date calc to give a whole number as you asked, so you may need to build in more logic, or use a previous hidden question etc, to work out the if the months are the same, there use different calculations if they are different.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Phil.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Jul 2020 02:31:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/survey123-date-calculation-using-12-hour-day/m-p/771153#M3797</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2020-07-29T02:31:04Z</dc:date>
    </item>
    <item>
      <title>Re: survey123 Date calculation using 12 hour day</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/survey123-date-calculation-using-12-hour-day/m-p/771154#M3798</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;righto....think I sorted it out.&lt;/P&gt;&lt;P&gt;I created a new question - round(decimal-date-time... for both the start and end time/dates.&lt;/P&gt;&lt;P&gt;This generates a number which i then used for my conditional calculation.&lt;/P&gt;&lt;P&gt;If end date - start date = 1, then...&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;If end date - start date = 2, then...&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;If end date - start date = 3, then...&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;and so forth...&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;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Jul 2020 02:57:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/survey123-date-calculation-using-12-hour-day/m-p/771154#M3798</guid>
      <dc:creator>timdunlevie</dc:creator>
      <dc:date>2020-07-29T02:57:25Z</dc:date>
    </item>
  </channel>
</rss>

