Survey123 Date Difference Calculation not working in Web

245
1
05-31-2023 01:53 PM
LukeCulleny
New Contributor

Hello!

I have a survey that I have built and have some basic calculations to store metrics on the time that a feature has stayed under a previous status for. I have a calculation that evaluates the time Now() and subtracts the time of the last status change to provide the time in that status in minutes. This formula works perfectly on the Survey123 Field App and Connect but doesn't seem to function on the web version. The exact formulas I have tried are: 

int((now() - ${previousstatusstarttime}) div (1000 * 60))

int((${statusdatetime} - ${previousstatusstarttime}) div (1000 * 60)) 

 

Is the Int function not supported on web? Is there a different way I could do this?

 

Also, as a bonus question I had a calculation that would break the minutes down into Days, Hours, Minutes for ease of viewing but that also doesn't work. That formula was:

concat(int((now() - ${previousstatusstarttime}) div (1000*60*60*24))," Days ", if(int(((now() - ${previousstatusstarttime}) div (1000*60*60)) mod 24) < 10,"0",""), int(((now() - ${previousstatusstarttime}) div (1000*60*60)) mod 24)," Hours ", if(int(((now() - ${previousstatusstarttime}) div (1000*60)) mod 60) < 10,"0",""), int(((now() - ${previousstatusstarttime}) div (1000*60)) mod 60)," Minutes")

 

Thank you for any help you can provide!!

0 Kudos
1 Reply
IsmaelChivite
Esri Notable Contributor

Check the Constraints and Calculations section in here: https://community.esri.com/t5/arcgis-survey123-blog/dates-and-time-in-survey123/ba-p/895528  You will want to use decimal time instead of UNIX time. Decimal time is a bit more painful to work with, but works in both the Field and web apps.

0 Kudos