Results 1 to 5 of 5
  1. #1
    Join Date
    Feb 2008
    Posts
    28

    Unanswered: Time Calculation

    Hello,

    I have a query in which I have a field for a Start Time and one for an End Time. Can someone help with a calculation and expression (and where in the query it should go) to determine Hours Worked? There are no breaks or non billed time between Start Time and End Time. I just need to tell access to show me 1 hour worked if someone starts at 5 pm and finishes at 6 pm.

    Thanks

  2. #2
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    [End Time] - [Start Time]

    Then format the result to hours using the Format property.
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

  3. #3
    Join Date
    Feb 2008
    Posts
    28

    Time

    Thanks for your help with the formatting. I have done this, but I cannot seem to properly record that 1.5 hours took place. How do i convert between a base 60 and a base 10 system of time and decimal?

  4. #4
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    When you do the subtraction, you'll get a result such as 0.0625. This represents the faction of a day that there is between the two dates. Formatting to "h:nn" would show 1:30... one hour and 30 minutes.

    If you want it to be 1.5 then you have to use math to convert days to hours... ei Multiply by 24.
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

  5. #5
    Join Date
    Jul 2003
    Location
    Amsterdam, Nederland
    Posts
    450

    RE:Calculate hours display in decimals

    startdate = 1 march 2008 09:00:01
    enddate = 1 march 2008 11:30:45

    if you do a datediff("n",startdate,enddate) 'where n stands for minuts

    Result = 150 '(min)

    if you want it in a fraction then divide it by 60
    150 / 60 =2.5

    1 0 1 elementry school stuf
    Greetz Marvels -^.^-
    Developments : VB4 Through .Net; Basic; DOS ; CNC ; Sinclair
    Databases : SQL Server Through 2005; Access 3 Through 2003 ; Oracle 8 & 9.i ;
    OS : Win 3.11 Through XP ; NortonComander ; DOS

Posting Permissions

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