Convert hours to hours and minutes

livvie

Registered User.
Local time
Today, 17:02
Joined
May 7, 2004
Messages
158
I have a calculated field that gives me 1.333333 hours how do I convert this into 1.20mins ? Here is the code I have tried :
SELECT EDATE, EMPLOYEE, OPERATION, DOWNREASON, JOB_ID, SUM(SETTINGH * 60 + SETTINGM) / 60 AS Setup, SUM(RUNNINHH * 60 + RUNNINGM)/ 60 AS Run, SUM(DOWNHOURS * 60 + DOWNMINS)/ 60 AS Down, DOWNTIME
FROM tblctjor
GROUP BY EDATE, EMPLOYEE, OPERATION, DOWNREASON, JOB_ID, SETTINGH, SETTINGM, DOWNTIME
 
CDate(1.333333/24) should give you the desired Value.
 
Calculate the difference in minutes rather than hours. Then convert minutes to hours and minutes. I posted a db containing useful date functions. See if there is something there that you can use. Search for it in the samples forum.
 
I have it working excpet 24hours is shown as 00:00 which I know it is but I need to show 24:00
 
I didn't look at Pat's sample, but a function like this could be used for customizing the output format.
Code:
Function TimeSumString(ByVal hrs As Long, ByVal mins As Long) As String
  TimeSumString = Format$(hrs + mins \ 60, "00") + ":" + Format$(mins Mod 60, "00")
End Function
 

Users who are viewing this thread

Back
Top Bottom