Calculating monthly bill date
Hello all,
I'm doing a simple db that stores customers using an internet service, billed monthly. How do I automatically calculate the monthly billing date. This will be the same date every month based on the date service began. The start date is stored in the database, but I am not sure how to auto calculate so that I can notify the user daily. Each customer will generally have a different payment date....
Thanks in advance!
Re: Calculating monthly bill date
Ok thanks. But how would this work 2 months after the due date?
I converted what you gave me to vb.net...
Code:
Dim startdate As Date = BillDateDateTimePicker.Text
Dim d1 As Date = DateTime.Parse(startdate)
Dim d2 As Date = d1.AddMonths(1)
MsgBox(d2.ToShortDateString())
Re: Calculating monthly bill date
I would actually have a couple more fields.... NextDueDate and LastPaymentDate.
When you process the next due always update the next due with the new value.
Re: Calculating monthly bill date
Your code should look like this :
Code:
Dim startdate As DateTime = DateTime.Parse(BillDateDateTimePicker.Text)
Dim d2 As Date = startdate.AddMonths(1)
MsgBox(d2.ToShortDateString())
So you pass '2' as parameter in AddMonths function.