0
Dec 12, 2009 at 04:40 PM

# How to calculate the time duration on a datetime column?

62 Views

Hi guys,

I've done some search on this forum and everywhere else but I can't seem to get this right, at the beggining it sounded like something very simple to accomplish, for the instance with Excel but I'm struggling to get it to work with Crystal Reports on Microsoft Visual Studio 2008.

I have a datetime column (SQL Server 2000) that I wanted to calculate the the time duration on the report group footer, unfortunatelly the built-in SUM function cannot be applied and I've tried several formulas that I've found on the internet without any luck. I'm using a datetime column to store only the time because I'm stuck with SQL Server 2000 which doesn't have a time data type.

Would you guys know how to do it by any chance?

Some sample code I've tried: http://www.minisolve.com/TipsAddUpTime.htm

Thanks a lot,

Paul

Edited by: Paul Doe on Dec 12, 2009 5:41 PM

Some sample data:

EMPLOYEE WORK HOURS

========= =================

JOHN DOE 1900-01-01 01:00:05

JOHN DOE 1900-01-01 00:20:00

JOHN DOE 1900-01-01 01:30:15

========= =================

HOURS WORKED: 02:50:20

Edited by: Paul Doe on Dec 12, 2009 5:42 PM

Edited by: Paul Doe on Dec 12, 2009 5:45 PM