|
-
Dec 5th, 2008, 01:52 PM
#1
Thread Starter
Lively Member
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!
-
Dec 5th, 2008, 02:29 PM
#2
Sleep mode
example
Code:
string startD="2/15/2008";
DateTime d1 = DateTime.Parse(startD);
DateTime d2 = d1.AddMonths(1);
MessageBox.Show(d2.ToShortDateString());
-
Dec 6th, 2008, 11:04 AM
#3
Thread Starter
Lively Member
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())
-
Dec 6th, 2008, 11:41 AM
#4
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.
Sometimes the Programmer
Sometimes the DBA
Mazz1
-
Dec 6th, 2008, 03:04 PM
#5
Sleep mode
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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|