Solved

calculate renewal date

Posted on 2012-04-05
2
305 Views
Last Modified: 2012-06-27
I've got to calculate the renewal date when the begindate begins per the given terms. I'm not sure how to go about it with due to the datatypes.

textbxBeginDate as Calendar   07/10/2011   datetime
textbxTerms as numeric   12     int
------
textbxRenewDate as Calendar   07/10/2012   datetime
0
Comment
Question by:fwstealer
2 Comments
 

Author Comment

by:fwstealer
ID: 37812614
tried this but not right
protected void getExpDt()
        {
            int terms = 0;
            DateTime programStartDt;
            DateTime expDt;

            if (textbxBeginDate.Text == "")
            {
                textbxRenewDate.Text = "";
            }
            else
            {
                programStartDt = Convert.ToDateTime(textbxBeginDate.Text);

                if (textbxTerms.Text == "")
                {
                    terms = 0;
                }
                else
                {
                    terms = Convert.ToInt32(textbxTerms.Text);
                    expDt = programStartDt.AddYears(terms);
//not quite right 4/2/2012 and 12 = 4/2/2024

                    textbxRenewDate.Text = expDt.ToString();
                }
            }  
        }
0
 
LVL 23

Accepted Solution

by:
wdosanjos earned 500 total points
ID: 37812893
It seems 12 is the number of months.  So you should have expDt = programStartDt.AddMonths(terms); instead.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
MVC5 Dataformat String for Phone not working 3 25
Sum Column in GridView 3 42
Authentication of Web Services 3 46
Need to pass stored proc parameters in list 13 32
We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
Concerto provides fully managed cloud services and the expertise to provide an easy and reliable route to the cloud. Our best-in-class solutions help you address the toughest IT challenges, find new efficiencies and deliver the best application expe…
Delivering innovative fully-managed cloud services for mission-critical applications requires expertise in multiple areas plus vision and commitment. Meet a few of the people behind the quality services of Concerto.

914 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now