Results 1 to 4 of 4

Thread: 1.5 to 1:30

  1. #1
    Guest
    This should be the last thing I need help on with this blocktime database. I have 1.5 hours in a field. How would I convert that to 1:30 minutes

    can someone help me out.

    Thanks
    Ken Devorak

  2. #2
    Junior Member
    Join Date
    Mar 1999
    Posts
    27
    Here's a simple function:

    Code:
    Private Function DecToTime(DecValue As Single) As String
        Dim Hour%, Min%
        Hour = Left(Str$(DecValue), InStr(1, Str$(DecValue), ".", vbTextCompare))
        Min = Val(Mid(Str$(DecValue), InStr(1, Str$(DecValue), ".", vbTextCompare))) * 60
        DecToTime = Hour & ":" & IIf(Min < 10, "0" & Min, Min)
    End Function
    used:

    stTime = DecToTime(1.5)

    It will return 1:30 - this also assumes that your decimal separator is a "." - if it's a "," then you need to make changes where necessary...

    Good Luck!

  3. #3
    Hyperactive Member
    Join Date
    Nov 1999
    Location
    Leavenworth KS USA
    Posts
    482
    Format(([sngl_time_fld] / 24), "h:mm") could also work.

  4. #4
    Addicted Member
    Join Date
    Jul 1999
    Location
    Portland, OR.
    Posts
    226

    Lightbulb

    Hi..

    Try this:

    X = 1.5

    Y = Int((X-Int(X))* 60)

    Good Luck.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width