To add 4 hours to Now or to some other DateTime isn't anything different...
Using your code, this is how it should look like:

DateTime t = Convert.ToDateTime("11/1/2002");
string s = t.ToString();      //this yields a time of 12:00 AM
t = t.AddHours(4);
s = t.ToString();              // Should now be 04:00 PM I guess :)

If you read the docs for DateTime.AddHours[1] then it is very clear that
this is the expected behaviour. Read especially the "Remarks" section...

hth,
Andreas Häber

[1]
ms-help://MS.VSCC/MS.MSDNVS/cpref/html/frlrfSystemDateTimeClassAddHoursTopic
.htm
----- Original Message -----
From: "Jeff Roberts" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, May 21, 2002 6:34 PM
Subject: Re: [DOTNET] DateTime.AddHours does not work !


Sean,

I don't want to add 4 hours to Now, I want to add 4 hours to an older
DateTime !

Thanks,

jeff

You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

Reply via email to