The calculation of two times

I have two time periods. How do I calculate the number of hours between them?

1 Like

Can you please provide an example?

If what you mean is to calculate the time between, say, 10:30 and 15:30 then just change both to the number of seconds and get the difference
((15 x 60) + 30) - ((10 x 60) + 30)

The value you get divide it by 60 to get the number of hours and the remaining is the number of minutes.

1 Like

Thank you so much for getting back to me, but I would like to use dates that are several years apart to find their hours, such as the number of days between 2021/10/3 and 2025/1/1. Of course, it would be nice if Thunkable could generate arbitrary timestamps.

Muneer Alshaikh via Community <thunkable@discoursemail.com> 于2021年10月3日周日 下午8:08写道:

1 Like

nobody knows chinese.

I’m sorry, but the truth is that only you can’t

1 Like

First of all, Thunkable provide the typical UNIX timestamp which you can find in the Device Drawer.
image
Which gives the number of seconds from 1st January 1970 until now. Not only that but the decimal point is providing up to the millisecond.

However, if I would want to count the days between two dates, I will connect Thunkable to Google sheet and do my calculation in the sheet. Thunkable app will be used to supply the two dates to the sheet and to read the result from the sheet.

1 Like

If you are unable to come to the solution on your own, please do consider contacting me for custom support in this matter! I can provide you a reasonable quote for this scope of work.

1 Like

Hey, buddy, your method really worked. It taught me something new. Thank you very much

1 Like