Tearing my hair out! Days linked to costs

Tearing my hair out! Days linked to costs.

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

Hi @herman ,

Convert the period into number by having number field in collection and update them with difference of date time fields.

The result would be fraction below 1 if it is less than a day, you can use this as conditional to further do actions.

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.

Example for 1 hour:


Example for 1 day:

Example for 1 week:

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.

@Flawless

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?

Thanks for the help
Abra



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.

Example:

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