How do i calculate duration in mit app inventor

To whom this may concern

Here comes another db run with diffferent data topics. I want to download data from firebase with specific data and do this by downloading tagslist and running the tagslist for the specific data.
Besides the data i want to have the newest data submitted. To do this i have calculated a clock duration with start and end. I use my db data with date dd-mm-yyyy and time HH:mm:sek. I get a flaw in the duration calculator. Is yhe format worng?

You need to show us the values of all your variables and list items....

Well i Have narrowed the flaw down to the duration block. I am certain the other ones work, but i suspekt the duration block cant read the dd-mm-yyyy from the database. The clock now should give a date and a time in a readable by the function. I cant describe all the variables and lists, and the question is also just for the duration function calculation.


What "date" string are you trying to feed the duration ? It needs to be an instant, and I doubt you have instants stored in Firebase.

I dont understand.
An instant means? I feed my duration block with start from the firebase dd-mm-yyyy and time HH:mm:ss.

You have applied instants to your "end" socket using Clock1.Now, so it should be apparent that you would apply an instant to the "start" as well.

You will need to convert your date string to an instant using this block (and some text manipulation!)


Want to see an Instant?

Put on your special sun glasses, so your eyes don't melt ...


(scary movie reference)

is this the manipulation you are talking about?

I do not know, you do not show the contents of "value", but you do seem to have the correct idea.

The content of value

dd-mm-yyyy HH:mm:ss

,,,except for the parts about confusing / with : and getting the date part indices reversed ...

Then this should do it:

The "at" value below "text" get global value is a single space

Thanks for the help.

I want to make my markers change color depending on the db data. I am using the function shown above to find the newest, but i have to find the right marker to change the color on. I use the marker title as this should be stable and comes from the same database. However i seem not not find the corresponding marker.

Write me if you need more information.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.