Robert L. Stewart
rl_stewart at highstream.net
Thu Jan 8 13:08:07 CST 2004
Try this Function HoursMinutes(ByVal intMinutes As Integer) As String ' This function will take a number of minutes and ' convert it into the format HH:MM Dim intHrs As Integer Dim strReturn As String Dim intMinuteRemainder As Integer intHrs = Int(intMinutes / 60) strReturn = CStr(intHrs) & ":" intMinuteRemainder = intMinutes Mod 60 strReturn = strReturn & IIf(Len(CStr(intMinuteRemainder)) < 2, "0" & CStr(intMinuteRemainder), CStr(intMinuteRemainder)) HoursMinutes = strReturn End Function Watch out for line wrapping. Robert At 12:00 PM 1/8/2004 -0600, you wrote: >Date: Thu, 08 Jan 2004 11:21:12 -0500 >From: CYNTHIA SPELL <CSPELL at jhuccp.org> >Subject: [AccessD] Formatting time - minutes to hour:minutes >To: accessd at databaseadvisors.com >Message-ID: <sffd3d32.028 at ccp2.jhuccp.org> >Content-Type: text/plain; charset=US-ASCII > >I have an application that tracks the amount of time spent on projects. I >used DateDiff on the entry form in order to get the number of minutes >between the start and end times. The number is held in a field called >"Time." In a report, I sum "Time" in order to get the total number of >minutes. I need to show the total minutes in hh:mm format on the >report. I tried to simply format the field in the report, but that didn't >work. > >I tried dividing the minutes by 60, which gave me the number of hours and >a remainder. I then multiplied the remainder by 60 and then divided by >100 to get the number of seconds. This is getting ugly.... Am I making >this harder than it is??