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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need to convert sum of minutes to “hours and minutes” for display 1

Status
Not open for further replies.

rorymo

Technical User
Nov 7, 2003
75
US
CR XI
Sql Server 2000

Grouping by:
Location
Ticket #

I have a summary of total minutes appearing under the location group, but I need to show the group summary total in the “hours and minutes” format. I don’t know how I can do this on a summary field that is in the Group 1 (location) footer.

Here is sample output: (this is under the location group)
Open Date Ticket # Close Date/Status Duration Duration Minutes
10/27/08 9:37 am R11269FY09 11/18/08 9:01 am 527 hrs 23 min 31,643.87
11/13/08 12:02 pm R19671FY09 12/23/08 7:39 am 955 hrs 36 min 57,336.87
12/17/08 9:58 am R33933FY09 4/14/09 9:14 am 2831 hrs 16 min 169,876.02
1/28/09 1:41 pm R55229FY09 2/4/09 2:07 pm 168 hrs 25 min 10,105.38
2/23/09 11:01 am R68059FY09 3/13/09 3:32 pm 436 hrs 30 min 26,190.55
3/12/09 10:43 am R78313FY09 4/24/09 9:46 am 1031 hrs 03 min 61,863.22

Group footer 1 Total (in minutes) 357,015.90 (I need to show this in hours and minutes.)

These are my formulas:
(we have to use these to convert the dates from a number format and account for daylight savings time changes)
@Opendate
UtcToDateTime ( (DateAdd ("s",({call_req.open_date}),cdatetime(1970,01,01,00,00,00))))
@Closedate
UtcToDateTime ( (DateAdd ("s",({call_req.close_date}),cdatetime(1970,01,01,00,00,00))))

@Hours Minutes
numberVar dur := datediff("s",{@Opendate} ,{@Closedate}); //get the seconds between 2 dates
numberVar hrs;
numberVar min;
stringVar hhmm;
hrs:= Truncate(Truncate(Truncate(dur/60)/60));
min := Remainder(Truncate(dur/60),60);
hhmm := totext(hrs,"00") + " hrs " + totext(min,"00") + " min" ;
hhmm;

I have looked at other threads but don’t quite know how to handle this. It is probably something simple that I am overlooking.
Thanks in advance,
rorymo


 
Set "dur" to your summary (whatever it is) times 60 to convert it into seconds:

numberVar dur := sum({@durationmins},{table.group})*60;
//etc.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top