diff between two days, in hours
I do not uderstand why the result of:
(DateTime.Now.Subtract(user.created_time.Value.Date)).Hours
is 23.
where:
DateTime.Now is:{3/30/2010 12:00:00 AM}
and
user.created_time.Value.Date is : {3/24/2010 12:00:00 AM开发者_StackOverflow中文版}
Does it make sense for anybody?
ps: I want to select all users created in last 72 hours so i suppose that is the way i should do...
Hours
just gives you the hours, and ignores the other fields like days. Use TotalHours
instead.
The Hours
property gives you the hours component of the TimeSpan
. Thus, if a TimeSpan
is more than a day, Hours
will give you only the hours part, without any full days.
You want the TotalHours
instead.
精彩评论