Solved

calculate renewal date

Posted on 2012-04-05
2
303 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
Comment Utility
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
Comment Utility
It seems 12 is the number of months.  So you should have expDt = programStartDt.AddMonths(terms); instead.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
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…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

771 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

15 Experts available now in Live!

Get 1:1 Help Now