Adding a TimeSpan to a given DateTime

Posted by Amokrane on Stack Overflow See other posts from Stack Overflow or by Amokrane
Published on 2010-04-29T13:18:44Z Indexed on 2010/04/29 13:27 UTC
Read the original article Hit count: 329

Filed under:
|
|

I just want to add 1 day to a DateTime. So I wrote:

 DateTime date = new DateTime(2010, 4, 29, 10, 25, 00);
 TimeSpan t = new TimeSpan(1, 0, 0, 0);

 date.Add(t);

 Console.WriteLine("A day after the day: " + date.ToString());

I tought the result would be: 2010 04 30- 10:25:00 but I'm still getting the initial date.

What's wrong?

© Stack Overflow or respective owner

Related posts about c#

Related posts about datetime