Avatar of programmher
programmher

asked on 

Using dtEnd.AddDays To Calculate Future Dates

I have an app that includes a calendar that allows users to select dates.   The customer wants to allow the users to schedule their meetings with this web page.  The user selects a date (like today) from a calendar.  Then, they enter a number in a field.  The code needs to calculate today's date plus the number of years entered in the text box and display that as a date.  Example:  today plus 5 years = 1/7/2019.

Here is the code that I'm trying to use to perform the calculation:
  {
        DateTime myStartDate, myEndDate;
        myEndDate.AddDays  (this displays the date selected by the calendar)

Open in new window


Is there a tutorial or webpage that displays the proper formatting to do what I'm trying to do?  I've tried myEndDate.AddDays(1), myEnddate.addDays(-1), etc but nothing works.  As you can tell, I am new to this so any help is appreciated.
C#Microsoft Development.NET Programming

Avatar of undefined
Last Comment
programmher
ASKER CERTIFIED SOLUTION
Avatar of dustock
dustock
Flag of United States of America image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
SOLUTION
Avatar of AndyAinscow
AndyAinscow
Flag of Switzerland image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
Avatar of programmher
programmher

ASKER

AndyAnscow - yes, there are values set before I use the AddDays function.
Avatar of programmher
programmher

ASKER

Dustrock - you are correct - my function was working.   I had someone validate that for me.  Thank you for your help.
.NET Programming
.NET Programming

The .NET Framework is not specific to any one programming language; rather, it includes a library of functions that allows developers to rapidly build applications. Several supported languages include C#, VB.NET, C++ or ASP.NET.

137K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo