Results 1 to 6 of 6
  1. #1
    gh1253 is offline Novice
    Windows 8 Access 2013
    Join Date
    Aug 2015
    Posts
    3

    Question hours and minutes conversion to hours and tenths of an hour

    Long time since I've worked in Access much less 2013 version. Have table with individual time in and individual time out in hh:mm format. Calculate difference between time in and time out with resulting time in hh:mm format. Want to convert this result to hh.h.

    Thanks for any assistance.

  2. #2
    InsuranceGuy is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Aug 2015
    Location
    Colorado
    Posts
    126
    Quote Originally Posted by gh1253 View Post
    Long time since I've worked in Access much less 2013 version. Have table with individual time in and individual time out in hh:mm format. Calculate difference between time in and time out with resulting time in hh:mm format. Want to convert this result to hh.h.

    Thanks for any assistance.
    You'll need to do some arithmetic.

    I'm doing this freehand, so forgive any issues...

    Code:
    dim outTime as string
    dim varTime as variant
    vartime=now()
    outtime = hour(vartime) & "." minute(vartime)\6
    msgbox vartime & vbcrlf & outtime

  3. #3
    gh1253 is offline Novice
    Windows 8 Access 2013
    Join Date
    Aug 2015
    Posts
    3
    thanks, but is there an easier way to just convert a resultant time of, say, 7:30 to 7.5 in either the cell with the calculation (=[ti]-[to] giving the 7:30 result or is it best to create a new table column and act directly on the calculated 7:30... I've tried a couple of ways but get errors indicating I cannot further calculate on a calculated field.

    tks

  4. #4
    InsuranceGuy is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Aug 2015
    Location
    Colorado
    Posts
    126
    Sure...

    hour([ti]-[to]) & "." & minute([ti]-[to])\6

    You can wrap the whole thing in a number conversion function if you want to do something with it other than a report.

  5. #5
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,825
    How are you getting the value output to hh:mm? Are you using Format function?

    DateDiff() function returns a whole number in whatever unit is specified.

    DateDiff("n", #7:30#, #21:22#) / 60

    returns:
    13.8666666666667
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  6. #6
    gh1253 is offline Novice
    Windows 8 Access 2013
    Join Date
    Aug 2015
    Posts
    3
    thanks, worked like a champ... sorry I took so long to get back to you. Now working on summing these sums.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. convert hours into minutes
    By princess12 in forum Access
    Replies: 5
    Last Post: 04-13-2015, 01:12 PM
  2. Replies: 4
    Last Post: 06-12-2013, 10:20 AM
  3. Converting minutes into hours in report
    By jinro in forum Access
    Replies: 13
    Last Post: 04-01-2013, 07:06 PM
  4. Converting Minutes Into Hours
    By KellyM in forum Reports
    Replies: 8
    Last Post: 04-23-2012, 12:49 PM
  5. How to calculate duration in hours & minutes
    By joypanattil in forum Access
    Replies: 0
    Last Post: 11-25-2009, 04:49 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums