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.
 
Back
Top