calculation based on time

J

jor

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. . .
 
A

Allen Browne

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
 
J

jor

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. . .
 
Top