a stupid problem about DateTime
-
hi guys.. i've never faced with a problem like this, just want to ask u guys.. i declared a datetime component ..
DateTime x = new DateTime(1900,01,01,7,0,0,0);
everything is fine.. let`s write it to a textbox name tBox;tBox.Text = x.toLongTimeString();
everything is ok.. i get 7:00:00 but after i add some minute to this instance..x.AddMinute(15); tBox.Text = x.toLongTimeString();
why the heck i get the 7:00:00 instead of getting 7:15:00 ?!?!?! any thoughts ? thanx good coding -
hi guys.. i've never faced with a problem like this, just want to ask u guys.. i declared a datetime component ..
DateTime x = new DateTime(1900,01,01,7,0,0,0);
everything is fine.. let`s write it to a textbox name tBox;tBox.Text = x.toLongTimeString();
everything is ok.. i get 7:00:00 but after i add some minute to this instance..x.AddMinute(15); tBox.Text = x.toLongTimeString();
why the heck i get the 7:00:00 instead of getting 7:15:00 ?!?!?! any thoughts ? thanx good codingYou have to assign the return value of
AddMinute
to your variable x. x itself isn't changed.x = x.AddMinute(15);
tBox.Text = x.toLongTimeString();
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook
-
You have to assign the return value of
AddMinute
to your variable x. x itself isn't changed.x = x.AddMinute(15);
tBox.Text = x.toLongTimeString();
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook
thanx a lot.. good coding