Calculate reservation hours

Hello, how can I calculate how many hours

I have two pickdate and time

Date 1: 12/17/21 16.00hs
DATE 2: 12/17/21 19.00HS

I need to do date 2 - date 1 … in Hours= 3hs * price

Hi @Santiago,

If I understood you correctly: you have 2 datepickers on your screen and you’d like to calculate the difference between them, in hours?

Then you can do the following:

  • create number property in some collection to store the result
  • update the value of this property as: ( Datepicker2_Value - Datepicker1_Value ) * 24.

Inside Adalo date is stored as a number, where integer part is number of days since 1/1/1970, and decimal part is the "part"of the day: e.g. 18956.5 means Thursday, 25 November 2021, 12:00 PM GMT+0.

So to get the number of hours you need to multiply the value by 24. You can also add INT or ROUND for the whole formula, to make hours an integer value.

Hope this helps.


1 Like

Hello, thank you @Victor Victor always for your answers and tutorials, there I will try to do it, meanwhile I made an invention, in the collection I put a number 13.00hs (13) 14.00hs (14) so ​​I did time piker 2 (number) - time piker 2 (number) that’s how it works for me, now I’ll try what you taught me

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.