In my website i store User Visit DateTime information in sql server using date data Type.
for that i used UtcNow in C# .
visit_date = System.DateTime.UtcNow
Now i want get the hours difference if same user visiting in my website so how can i subtract 2 UTC dates .I am using following way to get the diff in hour but it gives wrong hours difference.
TimeSpan timeDiff = System.DateTime.UtcNow.Subtract((DateTime)_Last_View.visit_date);
Try to get the Hours using the TotalHours on the resulting Timespan like: