Time

  • Thread starter Thread starter margaret
  • Start date Start date
M

margaret

Is there anyway for the time field to be configured on
100ths instead of 60th ... for instance, usually time if
figured 8:15 to 17:45, however, our time clock does time
as 8:25 to 17:75 ...
 
Nothing automated, but you should be able to write your own code to do the
same.

Something like the following untested aircode should convert to 100ths:

Function ConvertTimeToHundredths(TimeIn As Date) As String

Dim lngHour As Long
Dim lngMinute As Long
Dim lngSecond As Long
Dim lngTotalSeconds As Long

lngHour = Hour(TimeIn)
lngMinute = Minute(TimeIn)
lngSecond = Second(TimeIn)
lngTotalSeconds = lngMinute * 60 + lngSecond
ConvertTimeToHundredths = lngHour & ":" & _
Format(lngTotalSeconds / 36&, "00")

End Function

(Note that the 36 comes from the fact that there are 3600 seconds in an
hour, and I want to multiply the fraction of an hour by 100)

You can convert back as

Function ConvertTimeFromHundredths(TimeIn As String) As Date

Dim lngHour As Long
Dim lngMinute As Long

lngHour = CLng(Left(TimeIn, InStr(TimeIn, ":") - 1))
lngMinute = CLng(Mid(TimeIn, InStr(TimeIn, ":") + 1))
ConvertTimeFromHundredths = TimeSerial(lngHour, lngMinute * 0.6, 0)

End Function
 
That makes sense, however, where would I put this ... is
this for a control or do I do it for the whole database?
 
Those are functions that you can place in a module and then use them when
you want to display a time.
 
See if this works for you.

hour(now) & ":" & right("00" & format$(int(100*minute(now
())/60)),2)
 
Back
Top