Query Based on Weekdays vs Weekend

J

JMcMusicman

Is it possible with a date/time field in the General Date format (mm/dd/yyyy
hh:mm:ss) to query based on the Day of the week??

Trying to isolate entries from between Monday - Friday with the General Date
format.

Any help would be appreciated.

Thanks
 
D

Douglas J. Steele

SELECT Field1, Field2, Field3
FROM MyTable
WHERE Weekday(MyDateField) IN (2, 3, 4, 5, 6)

(Sunday is 1, Monday is 2 and so on up to Saturday is 7)
 
P

pietlinden

Is it possible with a date/time field in the General Date format (mm/dd/yyyy
hh:mm:ss) to query based on the Day of the week??

Trying to isolate entries from between Monday - Friday with the General Date
format.

Any help would be appreciated.

Thanks

?weekday(date())
3
?format(weekday(date),"ddd")
Tue
?format(weekday(date),"dddd")
Tuesday
?format(now,"dddd")
Tuesday
 
N

Nick

I have a follow up question. How would one number the work week where
Saturday in the prior week is the beginning of the work week and how could a
query be created to seperate the week based on critera stated.

Thanks,
 
J

John Spencer

The Weekday has an optional parameter to define which day of the week is the
first day of the week

So the call to the function
Weekday([DateField],7)
will calculate the weekday numbers with Saturday as day 1 and Friday as day
7

--
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
..
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top