Hi,
I would like to calculate the hours (in decimal time) between the current inspection date/time and the previous inspection date/time. 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. 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? Below is a copy of my form. Any help would be appreciated!!
calculation
now()
decimal
(decimal-date-time(${dateTimePrevious}) - decimal-date-time(${DateTime}))
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.
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:
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.:
All dates and times in S123 are captures in as a Unix Time Stamp.
All calculations (e.g., determining difference between two dates/times) needs to be done in Unix Time.
Whatever is captured in a date or dateTime question will print out as a "human date" in Feature Reports automatically.
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 format-date() or format-time() first.
hh:mm:ss = format-time(${your_question},'%H:%M:%S')
How to capture time input format hh:mm:ss. and do calculations in survey forms for example 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.
Thank you, that worked! I previously changed the field type to DateTime, but I think I just had the calculation incorrect.
Aangemelde leden kunnen berichten plaatsen, updates volgen en meer. Nieuw hier? Registreer een gratis account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.