[AccessD] integer in hh:mm format

Gustav Brock Gustav at cactus.dk
Thu May 28 06:55:43 CDT 2009


Hi Kostas

You can do it like this:

strHourMinute = FormatHourMinute(TimeSerial(0, 6910, 0))

and the function:

Public Function FormatHourMinute( _
  ByVal datTime As Date, _
  Optional ByVal strSeparator As String = ":") _
  As String
  
' Returns count of days, hours and minutes of datTime
' converted to hours and minutes as a formatted string
' with an optional choice of time separator.
'
' Example:
'   datTime: #10:03# + #20:01#
'   returns: 30:04
'
' 2005-02-05. Cactus Data ApS, CPH.

  Dim strHour       As String
  Dim strMinute     As String
  Dim strHourMinute As String
  
  strHour = CStr(Fix(datTime) * 24 + Hour(datTime))
  ' Add leading zero to minute count when needed.
  strMinute = Right("0" & CStr(Minute(datTime)), 2)
  strHourMinute = strHour & strSeparator & strMinute
  
  FormatHourMinute = strHourMinute
  
End Function

/gustav


>>> kost36 at otenet.gr 28-05-2009 13:42 >>>
hi group
I have a number e.g. 6910 
how could it converted in hours:minutes format
like 115:10

many thanks

/kostas






More information about the AccessD mailing list