Results 1 to 2 of 2
  1. #1
    dmpcs is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jul 2014
    Posts
    1

    Question Combining date and time values using DateDiff

    Hi, thanks to all for such a great and knowledgeable forum!

    I'm trying to create my own database dealing with hiring bikes on a daily basis.
    I have created a form for the basic input, including StartDate, StartTime, EndDate and EndTime, followed by TotalDays. I added the time field so that if a client brings a bike back an hour or two after the pickup time on a later date (sounds complicated - e.g he takes it on Monday at 12pm until Thursday 14pm) then he would be charged for an extra day. It is similar to the car rental system used worldwide.
    The TotalDays is currently using a simple expression =EndDate-StartDate.
    Is there any way to make the form incorporate the time difference so that if EndTime-StartTime>1 then it would add an extra day to the "=EndDate-StartDate" calculation.



    I hope this is clear...

  2. #2
    lfpm062010 is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2013
    Location
    US
    Posts
    415
    Couple observations.

    1) There is no need to split the date and time in 2 different fields. The date time type can store both date and time.
    2) Using DateDiff will calculate using the EndDateTime - StartDateTime.

    http://www.techonthenet.com/access/f...e/datediff.php

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

Similar Threads

  1. Replies: 1
    Last Post: 03-13-2014, 07:23 PM
  2. Calculate DateDiff on Time Added Field
    By athyeh in forum Queries
    Replies: 9
    Last Post: 12-18-2013, 02:10 PM
  3. DateDiff to include start date
    By AussieGal in forum Access
    Replies: 1
    Last Post: 05-07-2013, 02:50 PM
  4. datediff wrong values
    By spleewars in forum Queries
    Replies: 6
    Last Post: 04-10-2012, 08:53 AM
  5. Convert date format yyyymmdd for datediff
    By TEN in forum Programming
    Replies: 1
    Last Post: 06-17-2009, 09:35 PM

Tags for this Thread

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