Solved

calculate renewal date

Posted on 2012-04-05
2
322 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

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

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Suggested Courses

623 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