Calculating the duration of the user's absence on the discussion application, accompanied by blocks and aia file

My goal is to calculate how long a user has been away from the app but there is an error in the calculation. How can I fix that? The value that comes is not equal to the value that is supposed to be there sometimes, of course.
Can you help me to get the correct value in seconds, minutes and hours

This is my block


This is the aia file
D.aia (10.2 KB)

You can try this method, extension link

Link

This will give you in 0d 0h 0m 0s format. And you can split at space if you want to display as per your design… simple…

@Still-learning I think you understand what I mean, I want to calculate the user’s time for the application.
When arranging the blocks in this way, will I get the time of absence of the correct user

I tried as per this line… but now you are asking users time in app. For this why do you need web component and all… just use clock timer to enable. If it enables add 1000 by every sec

And use app stop block. In which save the time. So this will give you how long user spends time in app.

As per the above block you will get total time spent by the user in app… total time in the name days, hrs, mins and sec

@Still-learning
When I tried my work it worked.
When I leave the application, it gives me the duration of my absence when I return (if the period is short 《a few seconds》) but when the period is long it gives me the wrong value. You can look at aia and try the application if you want
D-1.apk (5.2 MB)

@Still-learning
Is it possible to convert the time from system 12 to system 24? I mean, time shift from 01:00:00 to 13:00:00 like the picture

Yes possible

BTW, try this apk for last seen as well as current time is adjusted …

tt.apk (5.4 MB)

I didn’t close the screen1 property… so work with your time visible screen alone. I adjusted all in mobile it self.

@Jihed

@Still-learning

The app didn’t work for me at all


There is something wrong

Net work must be enable to use

There is a connection and it does not work. I think I have a problem. Can you explain to me the blocks so that I can get a 24 system instead of 12 or an aia file
@Still-learning

LastSeen.aia (65.1 KB)

Try this…

Just change pattern from hh:mm:ss to HH:mm:ss


Modified above aia to reflect time shown in 24H instead of 12H
LastSeen_1.aia (65.2 KB)

1 Like

@dora_paz @Still-learning
Thank you very much I already worked

1 Like

@dora_paz @Still-learning
I only have a simple question when I exit the application at 23:30 at night and then return to the application at 00:00, meaning the next day (23:30-00:00) what will the result be
Will the absence period be 30 m or a negative result (23:30-00:00)

You won’t be getting negative values because we are taking the millis value only… as i post you early please use date tool extension in 0d oh om os format. And you can use if condition if the day is zero no need to show but if the user absence crosses then you must use

Imagine what will happen with your rule if the user is absent for couple of days… still it will show wrong hour, minute and seonds

An example

@dora_paz
Where can I add these blocks to get the value of absenteeism in days

In this post how i have used the extension in the label2 text, pls use the same and see

Those blocks where used just for testing purpose to get milliseconds needed. If you wish to also show days change blocks like this

1 Like