Working with TimeSpan

  • Thread starter Thread starter musosdev
  • Start date Start date
M

musosdev

Hi guys

I need to do some calculations based on a TimeSpan object.

The TimeSpan object is created from StartTime and EndTime (both DateTime
objects), and contains for example "02:00" to indicate 2 hrs.

I need to perform the following calculation on the TimeSpan

TimeSpan/(1/24)

This works in Excel in a Date/Time field, but I can't find ANY ConvertTo
that will allow me to perform this calculation, presumably because the
TimeSpan includes : ??

I think I can get round it by converting it to string, and then doing the
calculation on each section, but I really wanted to perform it directly on
the TimeSpan if at all possible.

Can someone enlighten me as to what I need/can convert it to to be able to
perform the calculation.

Thanks


Dan
 
Peter,

Thanks for help... TotalHours is exactly what I needed to avoid the
calculation entirely!

Cheers


Dan
 
Back
Top