473,396 Members | 2,010 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

DateTime.AddDays() doesnt work?

I need to add days to a DateTime variable, but even after calling the AddDays
function on it the value has not changed. The following code illustrates:

DateTime ReturnVal = new DateTime(2006,01,01);
ReturnVal.AddDays(1);

Is there another way to go about this, or am i doing something wrong?
Jan 17 '06 #1
2 5952
DateTime ReturnVal = new DateTime(2006,1,1);
ReturnValue=ReturnVal.AddDays(1);
"Michael Dawson" <Mi***********@discussions.microsoft.com> wrote in message
news:DD**********************************@microsof t.com...
I need to add days to a DateTime variable, but even after calling the
AddDays
function on it the value has not changed. The following code illustrates:

DateTime ReturnVal = new DateTime(2006,01,01);
ReturnVal.AddDays(1);

Is there another way to go about this, or am i doing something wrong?

Jan 17 '06 #2
Ahhhhh. I must be having a blond day. Thank you very much Norman.

Norman Yuan wrote:
DateTime ReturnVal = new DateTime(2006,1,1);
ReturnValue=ReturnVal.AddDays(1);
"Michael Dawson" <Mi***********@discussions.microsoft.com> wrote in message
news:DD**********************************@microsof t.com...
I need to add days to a DateTime variable, but even after calling the
AddDays
function on it the value has not changed. The following code illustrates:

DateTime ReturnVal = new DateTime(2006,01,01);
ReturnVal.AddDays(1);

Is there another way to go about this, or am i doing something wrong?


Jan 17 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Bavo | last post by:
Hi, I am trying to work with datetime functions in C#. Can anyone tell me how to get accurate yesterday using current datetime?? I want to display yesterday and today in two differnt text boxes...
2
by: MA | last post by:
Hi all! I use datetime to navigate in a calendar i´ve made. There is no problems navigating forward (AddDays()), but how do i remove days from DateTime? I would love to have something like this:...
13
by: bredal Jensen | last post by:
Hello gurus, I'm building a small booking system and i have come accross quiet a tedious pitfall. "I need to make sure that people do not book for tomorrow when todays time is greater or...
4
by: Andrew Wilhite | last post by:
Hello, I am just learning C# and I have ran into a problem that I cannot seem to resolve. I need to capture today's date, subtract a day, and then put it into the MM-DD-YYYY format. I know...
8
by: John Slate | last post by:
I have a situation where users will input a start date and an end date, then return the number of weekdays only. Is this possible with the DateTime class? *** Sent via Developersdex...
3
by: Bill | last post by:
Hi I am trying to get a date range in c#. I can get the one range by date1 = DateTime.Now(); But if I wanted to go back say 5 days how do I go about calculating the date for that. I was...
1
by: chris | last post by:
Hi there, I can not think of a way to display each day of the week between two dates. I have the following function which returns a date. How can I display those days? Or how can I put each of the...
2
by: O.B. | last post by:
Does C# provide an operation for converting year and day-of-the-year (1-365) to a DateTime object?
2
by: Luc The Perverse | last post by:
I was trying to make a quick 5 minute app to remind me to do something before leaving work - just have the dialog appear which showed in the quicklaunch bar. The application hung (which was...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.