calculation based on time

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

i tried this on my database to calculate the difference between onblock and
offblock but i got "00:00: answer. I am using QUERY to calculate the time.
on my table the onblock and offblock was formated as SHORT TIME.

DateDiff("n",Format([onblock],"Short Time"),Format([offblock],"Short Time"))

Please help. . .
 
Drop the Format(). The function outputs the Text type, which then has to be
converted back into Date/Time type, and there's opportunities for errors.

Just use:
DateDiff("n", [onblock], [offblock])

This might also help:
Calculating elapsed time
at:
http://allenbrowne.com/casu-13.html
 
Thanks allen.

Allen Browne said:
Drop the Format(). The function outputs the Text type, which then has to be
converted back into Date/Time type, and there's opportunities for errors.

Just use:
DateDiff("n", [onblock], [offblock])

This might also help:
Calculating elapsed time
at:
http://allenbrowne.com/casu-13.html

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

jor said:
i tried this on my database to calculate the difference between onblock and
offblock but i got "00:00: answer. I am using QUERY to calculate the
time.
on my table the onblock and offblock was formated as SHORT TIME.

DateDiff("n",Format([onblock],"Short Time"),Format([offblock],"Short
Time"))

Please help. . .
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top