Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Totalling aa time field 1

Status
Not open for further replies.

trishtrash

Technical User
Dec 21, 2006
13
GB
I have a field that reflects the time spent on a job

00:01
00:15
I need to sum these can you help please
 
You need Datediff. Format is
Code:
DateDiff ("n", {time1},  {time2})
It will return the difference in minutes.

With a different selection it can do the number of days, months, years or whatever.

[yinyang] Madawc Williams (East Anglia, UK). Using Windows XP & Crystal 10 [yinyang]
 
Apologies if I have mis-led you I am not looking for the difference in the times but a sum of a list of times (hr :Min) presented in a list as per examples
 
create two formula fields which will extract the hours and minutes from the field and place it in the same line as this field and supress them and create a summary on those and then create one more formula to convert the minutes and add them to the hours.

you can use left,right and mid functions to extract

hope this helps
 
Is your field of time datatype? Or is it a string?

-LB
 
If that were true there would be no time display. Please check again by running your mouse over the field and observing the tooltip text.

If it is a datetime field, then you can use a formula like this:

//{@mins}:
(hour({table.datetime})*60)+ minute({table.datetime})

Place this formula in the detail section and right click on it and insert a summary on it at the group or report level. If you want to express the results in hh:mm form, then use this formula:

numbervar mins := sum({@mins},{table.groupfield});
totext(truncate(mins/60),"00")+":"+totext(remainder(mins,60),"00")

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top