Results 1 to 3 of 3
  1. #1
    2 Star Lounger
    Join Date
    May 2001
    Location
    Maryland, USA
    Posts
    105
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Calculating hours (2000)

    I have tried to add a control to a form that calculates how many hours and minutes there are between two dates (from two controls formatted General Date) and can't seem to get it to work. I have set the format to "hh nn" and try to get it to calculate =[EndDate]-[StartDate]. It seems to ignore the dates and just calculate the time difference as if the times were on the same date. I've also tried to use the DateDiff function without any success. Anyone know an easy way to do this?

    Thanks,
    Eric

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Calculating hours (2000)

    Time format in Access doesn't handle time differences over 24 hours. To get the number of hours, use Int(([EndDate]-[StartDate])*24), and to get the number of minutes, use ([EndDate]-[StartDate])*1440 Mod 60.

    Dates and times are stored as a number of days; to convert to hours, multiply by the number of hours in a day (24), and to convert to minutes, multiply by the number of minutes in a day (24*60 = 1440).

  3. #3
    2 Star Lounger
    Join Date
    May 2001
    Location
    Maryland, USA
    Posts
    105
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Calculating hours (2000)

    Thanks again.

    Eric

Posting Permissions

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