You already have a correct code. The only problem is that offtime is assigned to the "default" time. Probably, you need to subtract two times with the same date, so the date would be taken out of equation. I don't know where you want to get another time, but one comes from your
DateTimePicker
. Copy it, and extract the date from it, with "zero" time part:
http://msdn.microsoft.com/en-us/library/system.datetime.date.aspx[
^].
Then, add required time to the copy. Assuming you know that time with the accuracy of seconds, use this:
http://msdn.microsoft.com/en-us/library/system.datetime.addseconds.aspx[
^].
You got two points of time, one from the picker, another from your known time. Subtract it and proceed the way you already did.
—SA