Solved

calculate renewal date

Posted on 2012-04-05
2
311 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

679 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