Results 1 to 9 of 9
  1. #1
    azhar2006's Avatar
    azhar2006 is offline Expert
    Windows 7 32bit Access 2010 32bit
    Join Date
    Mar 2012
    Posts
    528

    start time and end time

    Hello guys


    I have a table that contains the start time and end time.
    I want a function that calculates the eight hours after the beginning of time, meaning that if the start time field time is 8:00 end time field is 16:00
    thanks for help

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,772
    These are Date/Time, not text, type fields?

    Try DateAdd() function.

    However, adding 8 hours would return 4:00:00 PM which is 16:00 hours.

    Use Formatting to display as 24-clock time.
    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.

  3. #3
    azhar2006's Avatar
    azhar2006 is offline Expert
    Windows 7 32bit Access 2010 32bit
    Join Date
    Mar 2012
    Posts
    528
    Thanks very much June
    Well, but what is the function. Is it used in a query?
    Do you delete the end of time field in a table?
    It does not matter what kind of time, 12 or 24
    thank you my friend

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,772
    It's an intrinsic function. Search Access Help or web for details on using it.

    It can be used in query or textbox or code.
    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.

  5. #5
    bigot is offline Advanced...ish
    Windows 7 64bit Access 2010 64bit
    Join Date
    Feb 2014
    Posts
    37
    In Access, the date field is really a number (of days), if you want to add 8 hours, simply add 8/24.

    If you want to update all rows so your end time is 8 hours after the start time, you can do this:
    Code:
    UPDATE WhateverTableName
    SET endTime = startTime+(8/24)

  6. #6
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,870
    Why do you need to store EndTime if it is always StartTime + 8 hours?
    It can always be calculated.

  7. #7
    azhar2006's Avatar
    azhar2006 is offline Expert
    Windows 7 32bit Access 2010 32bit
    Join Date
    Mar 2012
    Posts
    528
    thanks friends
    Thank you orange
    What I want is to do my later by making all eight hours of vacation is one day.
    An example of this one person to the total hours are 16 hours = 2 and so on.

  8. #8
    bigot is offline Advanced...ish
    Windows 7 64bit Access 2010 64bit
    Join Date
    Feb 2014
    Posts
    37
    Quote Originally Posted by azhar2006 View Post
    making all eight hours of vacation is one day.
    An example of this one person to the total hours are 16 hours = 2 and so on.
    If you want to use this to give vacation time, you should not make EndTime = StartTime + 8 hours. You should keep EndTime as the actual time that the employee's shift ended. Then later do:
    Code:
    //Psudocode:
    TimeWorked = EndTime - StartTime
    ExpectedWorkHours = 8
    VacationHours = ExpectedWorkHours - TimeWorked.


    If EndTime is always StartTime+8, then you don't know how long they worked!

  9. #9
    azhar2006's Avatar
    azhar2006 is offline Expert
    Windows 7 32bit Access 2010 32bit
    Join Date
    Mar 2012
    Posts
    528
    Thank you bigot

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

Similar Threads

  1. Replies: 12
    Last Post: 07-19-2015, 05:21 PM
  2. Replies: 5
    Last Post: 04-11-2015, 03:54 AM
  3. Replies: 42
    Last Post: 03-01-2013, 06:58 AM
  4. Import Wizard does not start from time to time
    By emmett in forum Import/Export Data
    Replies: 1
    Last Post: 04-06-2012, 07:16 AM
  5. Replies: 7
    Last Post: 08-04-2011, 07:49 PM

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