Reinsert a time after stopping and reopening app

How can I apply the value, for example; 10:30 (as in of the clock) to a time picker and have the time picker treat is as a time instant?
User presses first time picker, time is saved to DB. Later, user presses second time picker and retrieves the previous selected time and reapplies the value to the first time picker. The calculation to determine the time between the clocks, treats the time in picker as null, and therefore hours worked is calculated to zero.
I have played with all I can think of with the pickers, clock1.everything.... I will continue to muck about... but could use a wise word from an experienced coder... thsanks


1 Like
  • Save the first time as milliseconds (from the instant).
  • Get the second time as milliseconds (from the instant).
  • Subtract first time from second time
  • Convert the result (in milliseconds) to hours and minutes



Cheers Tim.
Always a fabulous help. How do I extract a decimal value, as in 1.25, 1.5 hours, 7.5 hours, as opposed to the hours minutes? I seem to have a mental block with milliseconds


ps, the other problem I have is when I extract the value from the tinyDb, it inserts the extra long unabridged version of the google Gregorian date structure

1 Like

Like so:

It is not possible to save an instant to the tinydb. This is why I have suggested milliseconds

These are my blocks. If I do not leave the app, it works flawlessly. If I leave the app and come back, the time calculation is waaaaaaaay off.
How should I be saving/retrieving the time_in value? Am I not saving it as milliselconds here?

cheer Tim,

sorry to be such a dumb


(I am unable to do a screen shot as my chromebook emulator doesn't allow the activation of command buttons, so therefore cannot execute any commands)

1 Like

What do you see in your two labels when you click time out (after leaving the app and coming back ?

Could be that on chromebooks tinydb is not saved across sessions ?

re screenshots on chromebooks...

no command buttons required as far as I can see

1 Like

I know how to get a screen shot, but the app will not operate, so I cannot demonstrate the issue. the buttons don't work to arrive at the screen where i enter values, save, move on etc.

whilst on my phone, i go in and enter an IN time. (8 am)
leave the app, return to the screen. During a load routine, the IN time is loaded from TinyDB and placed into Time picker IN as 8:00:00 am
WHen I pick time out as 10:00 am, the duration comes out to 0.27. Not the 2 I am looking for.

I am working on the chrombook issue...\


You set the global time in again after getting the original global time-in ?

1 Like

d'oh! noobie!!

I think its a chrome book issue, It won't do a screen shot... grr!!

What chromebook do you have?

1 Like

Acer chromebook 714, about 18 months old. I rebooted it from scratch, seems to be working, also, i missed a couple of upgrades.
lesson learned... upgrades are our friends... Lol!!