2017년 5월 30일 화요일

time interval


I want to build an application simple enough as an accountant working overtime
I put two time picker, and I want the app to give me the time interval between them
Because the distribution of hours and minutes I keep getting an error of the abnormal data

I tried to look the forum and the network and did not find a solution .... I will be happy for any ideas

-- 

use Do it to debug your blocks, see also tip 4 here

It would really help if you provided a screenshot of your relevant blocks, so we can see what you are trying to do, and where the problem may be.

--


The whole thing is not as easy as it sounds and to calculate durations is quite hard. Therefore I spent my lazy sunday afternoon with making a little app.
Things to note: you do not want to have the app at the foreground while you are working overtime. Therefore the start time is stored in a TinyDB. If you do overtime again you must clear this time first.
The calculation of the duration in hours and minutes subtracts an hour. I cannot really explain it. It has something to do that your time will be in january 1970, but it works fine this way. I attached an .aia too.

--

this is other code, withclock and withoutclock

withoutclock you can use

--
That is a very nice solution!
In practice you still need a TinyDB though, because you do not want to loose the start time if the user closes the app while doing overtime.

--
@Juan, also take care not to work past midnight.
(Been there, done that).

--
OK Abraham, but user asks "put two time picker, and I want the app to give me the time interval between them", only difference beetween 2 TimePicker, not Date. This is only an example code.

--

댓글 없음:

댓글 쓰기