I want to create an app where users can rent things for a few hours, days or weeks from other users with special prices. An hour costs differently than a day and a day costs differently than a week. Have been trying to find a way to charge for the hours between two dates a user enters. How do I achieve this? I need a professional! thanks in advance

Assuming you have a rental “start date” and “end date”, you simply need to subtract the end date from the start date, store that number, then perform your calculations.

Then, you simply need to check the value of the calculation and perform your next calculation.

If calculated value is less than 1 (1 = 1 day), charge by the hour. If calculated value is greater than or equal to 1 and less than 7, charge by the day. If calculated value is greater than or equal to 7, charge by the week.

I had the same question as @herman. I followed your reply and understand the logic of what you are saying. What I don’t understand however is the number under each date/time that you generated/posted. Where did you get those numbers from? Did you generate these or is there a conversion formula somewhere? Also where does one store those numbers?

You store the start date and end date as datetime parameters and the calculated value as a number parameter in the same collection. The inputs are merely to show you the values and are not necessarily required.