I'm stuck with something that should be very simple.
Get & display current time
Save that time
Show time gap since last saved.
Eventually, I need somthing like that to calculate how many days have passed since last save, but I figure it's easier to experiment with the seconds intervall, as I would otherwise need to wait for midnight to test.
The error I keep getting is: The operation Duration cannot accept the arguments: , ["java.util.GregorianCalendar[time=1699092517324,areFieldsSet=true,areAllFie...
I have attached screenshots and the app.
Thanks for any help!
This works! Thank you very much!
Learnt something new that "TinyDb stores milliseconds and not instant".
Thank you also @AGB for those additional explanations, but what if I want to do this not for seconds but for days?
For my app, I want the app to recognize how many days have passed since the last "save". If the last "save" was a second before midnight and I open the app again 1 second after midnight, I want that to count as one day later.
But will that work even when less than a day has passed, as in the example I outlined above with the timestamps two seconds apart but on different days?
Basically, I want it to count one day even when just a second has passed, as long as midnight was passed.
In my opinion, it would not be logical. 1 day is 24 hours, so you can't say that something happened one day ago when it really happened 2 minutes ago. You can say that something happened yesterday without knowing exactly when. What will you display when 24 hours and 5 minutes have actually passed? Do you just want to display days without hours or minutes?
Yes, I want the app to tell me how many days have passed in the way that a person would say something took place yesterday, or one day ago, even though it's just after midnight. In other words, how often has midnight been passed since the last date save event.
I have an example of how to do that with a date picker (see screenshot and app attached), but now I want it to do that when screen 1 is inialized, basically simulating someone pressing the date picker and immediately clicking OK to stick with the default option (which is today's date)
Yes, thanks Ria, might do that if this fails. Just waiting 13 minutes till it's midnight here to see if the blocks Patryk suggested do the trick for me
If not, I'll just go with the extension, which might be easier for this.
This is what I have now. I hope that equals the example Patryk suggested.