convert number to time

referee

Registered User.
Local time
Today, 14:46
Joined
Aug 21, 2003
Messages
38
hi,

i have a field with numbers
how can ii convert the numbers to a total time

example:

number 65

I want to see: 1:05:00

how can i do this

thanks
 
you have 65 minutes then

an access datatime variable stores dates as fractional parts of a day

so - lets say 65 is minutes in a variable mymins
so divide mymins by 60 to get hours, and by 24 to get days

dim d as date
d = mymins/60/24

now you can display the d in any format you want

msgbox(format(d,"hh:mm:ss")) 'i think, or it may be hh:nn:ss (m is month in some cases)

the only catch is that time only goes up to 24hours like this, and wraps around.
 
A very simple solution maybe using Mod function

Public Function ConvNum_Time(intVal As Integer) As String

Dim strHours As String
Dim strMinutes As String

strHours = Format(Int(intVal / 60), "00")
strMinutes = Format(intVal Mod 60, "00")

ConvNum_Time = strHours & ":" & strMinutes & ":00"

End Function


Usage:
------
?convnum_time(65)
01:05:00

Good luck!
 
How about:

Timeserial(0,65,0)

returns date/time datatype:
01:05:00

hth
Chris
 

Users who are viewing this thread

Back
Top Bottom