I try this simple code
DateTime t1 = DateTime.Now;
DateTime t = DateTime.Now;
t.AddDays(20);
Debug.Print(t1.ToString());
Debug.Print(t.ToString());
But the Debug.output is the same.
06/01/2011 00:01:32
06/01/2011 00:01:32
I try both in spider and Bee.
If this methods not works how to change the time??
Thanks
AddDays and other DateTime methods return new instance.
try this:
DateTime t1 = DateTime.Now;
DateTime t = DateTime.Now;
t1 = t.AddDays(20);
Debug.Print(t1.ToString());
Debug.Print(t.ToString());
NickP
3
t.AddDays(20) doesn’t add days to t, it returns a new DateTime object
replace this:
t.AddDays(20);
with this:
t = t.AddDays(20);
@ NickP - How is that different from the post above?
Thank you Architect and NickP.
Ha, so simple answer, I am stupid.
It waste me all day. I should post early.
Thank you.
I am sure We all had moments like that. Sometimes a second pair of eyes is all that is needed.