c# - Showing Difference between two datetime values in hours -


i retrieving 2 date time values database. once value retrieved, need difference between 2 values. that, create timespan variable store difference of 2 date values.

timespan? variable = datevalue1 - datevalue2; 

now need show difference stored in timespan variable in terms of number of hours. referred timespan.totalhours couldn't apply same reason. how do that? using c# on mvc project. simple need show difference value in hours?

edit: since timespan nullable, couldn't use total hours property. can use doing timespanval.value.totalhours;

i think you're confused because haven't declared timespan you've declared timespan? nullable timespan. either remove question mark if don't need nullable or use variable.value.totalhours.


Comments

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -