Skip to content

Date time picker

durga prasad

Asked Aug 8, 2008, 10:00 PM EDT1 answer
Share
LinkedInX
I use timespan and datetime pickers in my project, it calculates correctly for todays time for eg.,(dtpouttime-dtpintime), but in case if there is shift which starts today
and ends the next day and probably that may even extend to one more day(If the employee works over time ).I am finding difficulty in calculating this, cam any one help me ,how to calclate this thing.

Thanks in Advance,
A.Durga Prasad

1 Answer

Know the answer? Post it. Somebody with the same question will find it here.

  • 0
    I try this code, and it works just fine for me.I think you only use the Hours and not the Days.Sorry for the bad English :D

                TimeSpan ts = dateTimePicker2.Value - dateTimePicker1.Value;
                label1.Text = ts.Days.ToString() + ":" + ts.Hours.ToString() + ":" + ts.Minutes.ToString() + ":" + ts.Seconds.ToString();
    0