Pulling records given a time and date perimeter.

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

Guest

I'm trying to run a report that gives information based on dates and time ranges. The table provides the date and time information as one date time format example.... "03/01/04 08:00:00 AM"

So what I want to do is find all records for the month of Febuary only between the hours of 8am to 5pm during the weekdays. Excluding all other records on the weekends and the hours of 5:01pm and 7:59am

Any ideas?
 
WHERE DateTimeField >= #2/1/04# AND DateTimeField < #3/1/04#
AND Hour(DateTimeField) Between 8 and 16
AND WeekDay(DateTimeField) Between 2 and 6

If you want all years then change the first line to
WHERE Month(DateTimeField) = 2
AND ...
 
Back
Top