t = t.AddHours(4)

It returns the new time.  It doesn't affect the current one.

---
Patrick Steele ([EMAIL PROTECTED])
Lead Software Architect
Image Process Design



-----Original Message-----
From: Jeff Roberts [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, May 21, 2002 12:26 PM
To: [EMAIL PROTECTED]
Subject: [DOTNET] DateTime.AddHours does not work !


I am trying to add to the hours of a DateTime object and it does not seam to
work:

DateTime t = Convert.ToDateTime("11/1/2002");
string s = t.ToString();      //this yields a time of 12:00 AM
t.AddHours(4);
s = t.ToString();                     //still yields a time of 12:00 AM

Why doesn't the Hour property change ?

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