Filter Weekdays and Intervals

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

Guest

Hi,

Is possible to query only data in Weekdays Mon to Fri between Intervals 7:00 am to 7:45 PM ?
 
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Depends on how you store the date/time data. If all in one column
try:

....
WHERE WeekDay(Date_Column) Between 2 and 6
AND CDbl(CDate(Format(Date_Column, "hh:nn"))) Between
0.291666666666667 And 0.822916666666667

vbMonday = 2
vbFriday = 6
0.291666666666667 = 07:00:00
0.822916666666667 = 19:45:00 [7:45 pm]

Times that are between 19:45:00 and 19:45:59 will be included in the
result set.

It would probably run faster if the time data were stored in a
separate column (and indexed) then you'd not have to include the
Format() function and the CDate() function, 'cuz the data would be
stored as a DateTime data type. You might even get by using this as
the criteria:

WHERE Time_Column Between #07:00# and #19:45#


MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQEz9ZYechKqOuFEgEQL65wCfcpPja+69MoiHzRuBHg96tUwJOwQAnAxg
KijzsfjxCdi26bszaO2j7X/u
=45lP
-----END PGP SIGNATURE-----
 
Back
Top