I have two dates. One supplied by the user and accurate to the second and one from the database and accurate to the tick level. This means when they both represent 13/11/2009 17:22:17 (British dates)
userTime == dbTime
returns false
The tick values are 633937297368344183 and 633937297370000000.
To fix this I use the code
userTime = new DateTime(
userTime.Year,
userTime.Month,
userTime.Day,
userTime.Hour,
userTime.Minute,
userTime.Second);
dbTime = new DateTime(
dbTime.Year,
dbTime.Month,
dbTime.Day,
dbTime.Hour,
dbTime.Minute,
dbTime.Second);
Is there a more elegant way to achieve this?