This time difference is called Time Span (
System.TimeSpan
structure) and is calculated, not to much of surprise, using '−' operator. I hardly can understand how could you miss it. It could be like this:
System.DateTime login = System.DateTime.Now;
System.DateTime logout = System.DateTime.Now;
System.TimeSpan timeSpan = logout - login;
I cannot see why would you need a
DateTimePicker
here, but if you need, it also has the value of
System.DateTime
. Conceptually, there is no date and time, there is only time. Only you should not work with members of these structures separately. They have everything to calculate what you need.
http://msdn.microsoft.com/en-us/library/system.datetime.aspx[
^],
http://msdn.microsoft.com/en-us/library/system.timespan.aspx[
^].
—SA