   [.net] VB.NET - Modify the date part of a DateTime object?
  On startup my program reads in a DateTime value from the registry. What I need to do is to compare the time part of this DateTime value with the time part of DateTime.Now(). There doesn't seem to be an easy way to do this directly so I figured it would be a good idea to load the DateTime value from the registry and right after loading it, change the date part of the loaded DateTime to match DateTime.Now(). After attempting this I found that the properties of the DateTime object that I would have changed were read only.Is there an easy way to modify a DateTime object like this? If so how?Thanks![Edited by - InsaneBoarder234 on June 14, 2006 9:45:55 AM]
  On the DateTime object is a property called TimeOfDay which returns an TimeSpan object. The TimeSpan class contains a static "Compare" method which compares 2 TimeSpan objects. (Sorry, I'm a vb.net guy)//The DateTime object from your registrydim dt as Datetime = //get the valuedim compareValue as integercompareValue = TimeSpan.Compare(dt.TimeOfDay, DateTime.Now.TimeOfDay)Lookup MSDN to get details about the returnvalue of the compare method   ;  Cheers!   