I have two dates. One is user-provided and accurate for the second and one of the database and accurate to the tick level. This means that both of them represent 11/13/2009 17:22:17 (UK dates)
userTime == dbTime
returns false
Tick ββvalues: 633937297368344183 and 633937297370000000.
To fix this, I use 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?
source
share