AddSeconds (VS2003)

  • Thread starter Thread starter Marius Horak
  • Start date Start date
M

Marius Horak

DateTime X = new DateTime(2000,1,1,0,0,22); <-- debugger is showing
X.Minute = 0, X.Second = 22;
X.AddSeconds(32); <- still X.Minute = 0 X.Second = 22;

What's wrong?

Thanks

MH
 
AddSeconds dont't manipulate the DateTime itself, instead it returns the
modified DateTime. You sould write:
DateTime X = new DateTime(2000,1,1,0,0,22); <-- debugger is showing
X.Minute = 0, X.Second = 22;
X = X.AddSeconds(32);

GP
 
Günter Prossliner said:
AddSeconds dont't manipulate the DateTime itself, instead it returns the
modified DateTime. You sould write:
DateTime X = new DateTime(2000,1,1,0,0,22); <-- debugger is showing
X.Minute = 0, X.Second = 22;
X = X.AddSeconds(32);

Thank you GP.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top