# date calculation based on double

Gday,

I am in a bit of a pickle, may just be the hour that Im still up working.. however what i need to achieve is to come to a date based on a double which is the amount of money being collected.

my software charges interest on a loan per month or part thereof. when a loan is processed a due date is calculated based on X number of months (predefined). So a loan drawn up today (2011-12-23) where X = 3 the due date would be 2012-03-23.

if the person whom has obtained the loan cannot pay the loan back by the due date they can make a payment on this loan to extend the due date. If the the interest on this loan is \$30.00 per month or part thereof and they make a payment of \$30.00 the loan due date is extended by 1 month becoming 2012-04-23, if the person is to pay \$60.00 then the loan due date would be extended by 2 months becoming 2012-05-23, and so on.

the above calculation is easily achieved. my issue is when the amount being paid is not equal of the monthly interest. Say the customer only pays \$15.00 the due date would need to be recalculated to somewhere in the middle of the 2012-03-23 and 2012-04-23. If the person was to pay \$45.00 then the due date would be recalculated to somewhere in the middle of 2012-04-23 and 2012-05-23.

If anyone would be willing to help me that would be great :) thanks guys!
###### Who is Participating?

Commented:

Calculate the perday intrest.
like as you said " they make a payment of \$30.00 the loan due date is extended by 1 month "

So intrestPerDay  = \$30 / no. of days.
Or if you have that value of intrestRate per day.

Then payment made /  intrestPerDay   = increasedDueDays
and hence you can add these days to current due date.

Hope you need the same.
If you need syntax to add dates or for somthing else then let me know.

Thanks.
0

Author Commented:
Hey there,

Thanks for the help, i did think of that but where i get stuck is how do i work out how many days there are to calculate the date?
0

Commented:
Hey,
I didnt get you correctly...
Are you missing syntax to calculate days from date or
you dont know  how to calculate intrestRatePerDay? (as there are no such specific method)

If you dont know the syntax then let me know I can help you ..
But I guess on logical part even I am stuck as no clear requirement.

Thanks.
0

Author Commented:
I am having trouble writing the code to work out the interest rate per day. its a bit difficult as there is not a fixed amount of days between two days/dates.

say for instance, the loan is due on the 2011-10-10 and the person holding the loan came in to extend the due date by paying \$15.00, to get the due date to the 2011-11-10 the person needs to pay \$30.00. however they can only pay \$15. Logic would have it that there is 31 days between 2011-10-10 & 2011-11-10 so the person is paying half the \$30.00 the date should extend by half of 31 days being 15.5 days. with rounding down you get 15 days so the new due date would be 2011-10-25.
0

Commented:
``````        Dim DueDate As Date = "23/12/2011"
Dim AmountToExtend As Double = 30.0
Dim PaidAmount As Double = 15.0
Dim jh = (PaidAmount / AmountToExtend) * 30
Dim NewDueDate = DueDate.AddDays((PaidAmount / AmountToExtend) * 30)
Dim InWords = NewDueDate.Day & " " & NewDueDate.Month & " " & NewDueDate.Year
``````
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.