Subtracting Time

  • Thread starter Thread starter DS
  • Start date Start date
D

DS

How do you subtract time on a report? Sometimes it goes over midnight,
Sometimes its for several days. I would need total hours and minutes
worked in decimals.
Thanks
DS
 
If you're storing date and time, use the DateDiff function. Get the elapsed
time in minutes, and then convert to hours and minutes. Info about DateDiff
is in Help file.
 
Ken said:
If you're storing date and time, use the DateDiff function. Get the elapsed
time in minutes, and then convert to hours and minutes. Info about DateDiff
is in Help file.
I tried it and I keep getting a Syntax error, It says Comma.


DateDiff("h",[Date In],[Date Out])

Any suggestion on what might be wrong?
Thanks
DS
 
Where are using this expression? If in a control source of a textbox:
=DateDiff("h",[Date In],[Date Out])


--

Ken Snell
<MS ACCESS MVP>

DS said:
Ken said:
If you're storing date and time, use the DateDiff function. Get the elapsed
time in minutes, and then convert to hours and minutes. Info about DateDiff
is in Help file.
I tried it and I keep getting a Syntax error, It says Comma.


DateDiff("h",[Date In],[Date Out])

Any suggestion on what might be wrong?
Thanks
DS
 
Another possibility is that the user's Regional Settings may require
semi-colons instead of commas in the DateDiff function:

DateDiff("h";[Date In];[Date Out]) or =DateDiff("h";[Date In];[Date Out])


--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



Ken Snell said:
Where are using this expression? If in a control source of a textbox:
=DateDiff("h",[Date In],[Date Out])


--

Ken Snell
<MS ACCESS MVP>

DS said:
Ken said:
If you're storing date and time, use the DateDiff function. Get the elapsed
time in minutes, and then convert to hours and minutes. Info about DateDiff
is in Help file.
I tried it and I keep getting a Syntax error, It says Comma.


DateDiff("h",[Date In],[Date Out])

Any suggestion on what might be wrong?
Thanks
DS
 
Ken said:
Where are using this expression? If in a control source of a textbox:
=DateDiff("h",[Date In],[Date Out])
Ken got it to work, I deleted the text box and rebuilt a new one then
it worked fine, go figure?
DS
 
Back
Top