Now() > DD HH MM query??

  • Thread starter Thread starter Peter Allanach
  • Start date Start date
P

Peter Allanach

Hi,

I have a table with a date field. Can anyone advise what
the correct criteria is for returning only the records
with a date/time of for the last 24hrs ie specifically
from 1700hrs yetserday to 1700hrs today.

Thanks in advance.
 
HI,



BETWEEN Date() -#05:00:00# AND Date()+#17:00:00#



Hoping it may help,
Vanderghast, Access MVP
 
Hi,

I have a table with a date field. Can anyone advise what
the correct criteria is for returning only the records
with a date/time of for the last 24hrs ie specifically
from 1700hrs yetserday to 1700hrs today.

Thanks in advance.

BETWEEN DateAdd("h", -5, Date()) AND DateAdd("h", 17, Date())

will do it. Date() returns midnight at the beginning of today.

If you want to return literally the past twenty-four hours, e.g. from
2:28:31pm yesterday to 2:28:31pm today, use

BETWEEN DateAdd("h", -24, Now()) AND Now()
 
Back
Top