Working with TimeSpan

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
 
M

musosdev

Peter,

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

Cheers


Dan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

DataTable.Select with condition with Timespan values 1
Can't serialize a TimeSpan to XML 3
TimeSpan inadequacies 3
Deploying WCF 5
hello 2
TimeSpace.Parse() usage 3
TimeSpan object question 6
TimeSpan Object 1

Top