# Thread: sum elasped time

1. Registered User
Join Date
Aug 2003
Posts
64

## Unanswered: sum elasped time

Maybe if I ask this question differently, I tried on a separate forum...

Trying to sum the overall elasped time in hours using "start" and "end" times in separate fields from multiple rows. I have tried datediff, timediff and datepart functions on this attemp.

When converting the results in minutes I can easily sum (overall) the results like so; DatePart("h",[Elasped])*60+DatePart("n",[Elasped]).
But I can not do in hours like; DatePart("h",[Elasped]) & ":" & DatePart("n",[Elasped]) to sum (overall) in hours.

Secondly how can I sort using months?

2. Registered User
Join Date
Nov 2003
Location
LONDON
Posts
238

## Re: sum elasped time

Originally posted by comf36
Maybe if I ask this question differently, I tried on a separate forum...

Trying to sum the overall elasped time in hours using "start" and "end" times in separate fields from multiple rows. I have tried datediff, timediff and datepart functions on this attemp.

When converting the results in minutes I can easily sum (overall) the results like so; DatePart("h",[Elasped])*60+DatePart("n",[Elasped]).
But I can not do in hours like; DatePart("h",[Elasped]) & ":" & DatePart("n",[Elasped]) to sum (overall) in hours.

Secondly how can I sort using months?

To calculate the sum of elapsed hours use the following example:

SELECT SUM(DATEDIFF("h", [START_TIME_FIELD], [END_TIME_FIELD])) AS DIFF_HOUR
FROM MY_TABLE

To sort using months the best way is to create a table of months with 2 fields:

ORDER_ID as an integer
MONTH_NAME as text

Enter the correct order id for the month. Whenever you want to sort by month join this table using the month field as the join item and use the ORDER_ID as the ORDER BY clause

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•