Results 1 to 4 of 4
  1. #1
    smahdih is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2011
    Posts
    52

    adding and subtracting two time

    Dorod

    in a query i have four date/time fields,


    Date1 formatted yyyy/mm/dd
    Time1 formatted short time
    Date2 formatted yyyy/mm/dd
    Time2 formatted short time

    i want in a new field insert ( (Date2 - Date1) + (Time2 - Time1) ) formatted hours

    for example :
    date1 = 2011/01/05
    Date2 = 2011/01/06
    Time1= 10:20
    Time2 = 20:30

    Date1 - Date2 = 24Hours
    Time1 - Time2 = 10:10
    ((Date1-Date2) + (Time1-Time2)) = 34:10

    How i can build it?

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    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
    smahdih is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2011
    Posts
    52
    Quote Originally Posted by June7 View Post
    i use datediff , but when adding two time , if plus two time was over 24 hours not display over 24

    my query attach

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    If you calculate a full date/time field should work. This is why best to store date/time as one value, not in separate fields. The time needs a valid date part to calculated elapsed hours for period crossing midnight.
    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.

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

Similar Threads

  1. vba > subtracting time
    By metokushika in forum Access
    Replies: 2
    Last Post: 12-09-2014, 09:17 PM
  2. Adding Time help
    By Bozilla in forum Forms
    Replies: 3
    Last Post: 11-08-2011, 09:18 AM
  3. adding time & date
    By tyekhan in forum Queries
    Replies: 1
    Last Post: 07-21-2011, 08:13 AM
  4. Adding Time
    By jlclark4 in forum Queries
    Replies: 7
    Last Post: 05-04-2011, 10:35 AM
  5. Help with Adding Time Stamp to Contact
    By shanethomp in forum Access
    Replies: 1
    Last Post: 11-09-2010, 09:43 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