PHP Formula Help
Posted: Mon Jan 20, 2014 2:34 pm
I rent out caravans and am looking to offer pay monthly options. We have worked out a formula in Excel but need to convert it to PHP.
The excel formula is:
monthlyCost=SUM("holidayCost"/(roundDown(((("holDate"-30)-"todaysDate")/30),0)))
The problem is rounding the number down.
Example 1
Holiday Price = £400
Holiday Date = 1/7/2014
Monthly Cost = £100
Example 2
Holiday Price = £400
Holiday Date = 22/7/2014
Monthly Cost = £80
Example 2 is reduced as there is an extra month of payments due to the round down.
Can anyone help as we cannot work it out.
The excel formula is:
monthlyCost=SUM("holidayCost"/(roundDown(((("holDate"-30)-"todaysDate")/30),0)))
The problem is rounding the number down.
Example 1
Holiday Price = £400
Holiday Date = 1/7/2014
Monthly Cost = £100
Example 2
Holiday Price = £400
Holiday Date = 22/7/2014
Monthly Cost = £80
Example 2 is reduced as there is an extra month of payments due to the round down.
Can anyone help as we cannot work it out.