date time stamp

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

Guest

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
 
WHERE MyDateField > DateDiff("h", -24, Now()) will give you anything in the
last 24 hours.

For specifically between 17:00 today and 17:00 yesterday, try:

WHERE MyDateField BETWEEN (DateDiff("d", -1, Date()) + TimeSerial(17,0,0))
AND (Date() + TimeSerial(17,0,0))

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


"dave buckberry"
 
Back
Top