So how did *you* work out that the time spent was 46 hours 25 minutes? That process is what you want to put into code, so you had better know what it is.
So how did *you* work out that the time spent was 46 hours 25 minutes? That process is what you want to put into code, so you had better know what it is.
I don't see how only calculating the equation above gives you the total days of rental. What about months? Years? Days? Minutes? All of these contribute to total days.
How exactly does the output need to be formatted? In one post you mentioned only hours and minutes, whereas in another you mentioned date and time in military format. For example, if you only need to display total number of hours and minutes rented, it would make more sense to convert the year, month, and day differences into simply hours (since it will be a whole number) and calculate the minute difference separately.
Thank you all for the help.
I found the core equation that I needed
and now I just have to fix up the cost and find out how to account for leap years...!Code:totalreturnTime = (returnyear * 365 * 24 * 60) + (returnmonth * 31 * 24 * 60) + (returnday * 24 * 60) + (returnhour * 60) + (returnmin); totalrentTime = (rentyear * 365 * 24 * 60) + (rentmonth * 31 * 24 * 60) + (rentday * 24 * 60) + (hour * 60) + (min); rentTotal = totalreturnTime - totalrentTime; totalTimeHour = rentTotal / 60; totalTimeMin = rentTotal - (totalTimeHour * 60);