Results 1 to 5 of 5

Thread: Time Calculation

  1. #1
    Join Date
    Feb 2004
    Location
    Malaysia
    Posts
    2

    Unhappy Time Calculation

    Does anybody can help me calculate time which more than 24 hours?

    I had used
    DateDiff("n",[time attend],[time finished]).
    It does not give me the correct answer when somebody attend it at 21:45 and finished at 05:30 the next day.

  2. #2
    Join Date
    Jan 2003
    Location
    UK
    Posts
    277

    Re: Time Calculation

    Originally posted by afifudin
    Does anybody can help me calculate time which more than 24 hours?

    I had used
    DateDiff("n",[time attend],[time finished]).
    It does not give me the correct answer when somebody attend it at 21:45 and finished at 05:30 the next day.
    What answer do you get ?

  3. #3
    Join Date
    Sep 2002
    Location
    Fantasy
    Posts
    4,254
    try this

    --Hours
    SELECT (#1-18-2004 05:30:00#-#1-17-2004 21:45:00#)*24
    --Minutes
    SELECT (#1-18-2004 05:30:00#-#1-17-2004 21:45:00#)*24*60
    --Seconds
    SELECT (#1-18-2004 05:30:00#-#1-17-2004 21:45:00#)*24*60*60

  4. #4
    Join Date
    Feb 2004
    Posts
    8
    I believe your answer is displayed back to you in minutes and seconds instead of hours and minutes... so you could do something like this.

    =Int([Duration]/60) & "hour(s) and " & ([Duration])-((Int([Duration]/60))*60) & "minute(s)"

    where [duration]= DateDiff("n",[time attend],[time finished]).

    I forget why I needed the Int, so you may or may not need that and technically you could just paste your formula everywher it says duration. All this does is divide the duration by 60 to get you hours and then gives you the remainder by subtracting the hours from total and leaving only the leftover remainder minutes. You could just as easily replace hours and minutes and put back in the hh:mm format.

  5. #5
    Join Date
    Feb 2004
    Location
    Malaysia
    Posts
    2

    Time Calculation

    The output in my report having -975min which is not true. the true answer is 465min. I'm going to try some other method replied by others & keep you all posted.

Posting Permissions

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