473,395 Members | 1,974 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Selecting Weekday

ddtpmyra
333 100+
Hello,

I need help on how to tell my query to only get data that are fall on weekendays and skip the weekends.

For instance I have set of records from April 1 to date and I only want to pick data starting March 1 and today's date (5/6/2011) less 6 business day. The query should skip the the weekends and date range should be April 1 to April 29.

thanks to those who would like to help me here :)
May 6 '11 #1

✓ answered by Rabbit

The weekday function will return a number from 1 to 7 where 1 is Sunday and 7 is Saturday.

3 1765
Rabbit
12,516 Expert Mod 8TB
The weekday function will return a number from 1 to 7 where 1 is Sunday and 7 is Saturday.
May 6 '11 #2
NeoPa
32,556 Expert Mod 16PB
You can include in your WHERE clause something like :

Expand|Select|Wrap|Line Numbers
  1. (Weekday([DateInRecord],vbMonday)<6)
PS. Weekday can be flexible and return 1 to 7 starting any specified day of the week. Starting Sunday is the default.
May 7 '11 #3
ddtpmyra
333 100+
Thank your for all your response. Yeah this is what I thought of last Friday is to assign each number for the day and do condition only to select 2-6 so that will eliminate the weekends.

this how it look like
Expand|Select|Wrap|Line Numbers
  1. WeekNo: Weekday([LOG])
May 9 '11 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: dr. zoidberg | last post by:
Hello, I have this: Mon, Tue, Wed, Thu, Fri, Sat, Sun created as links. What I would like to do is to associate days with its current week dates, for example: Mon (05.01.2004); Tue...
2
by: David Morgan | last post by:
Hi Hopefully the subject says it all. Given a weekday, (1 to 7) and an occurrence with in a month, (1 to 4), I need to ascertain the date on which it first occurs in any given month and year. ...
2
by: Chumley the Walrus | last post by:
I can't locate a weekday function in asp.net, whereas I just want to grab the weekday associated with a given date. I'm using this date format {0:MM/dd/yyyy} in references in my code, just need to...
1
by: Kd | last post by:
I am currently using a form with Weekdays Mon Tues Wed Thur Fri This is generated by a table that the days are being entered manually I would like to create a form that the days updated...
4
by: GregginOttawa | last post by:
I've been Googling and reading for 5 days now trying to figure out how to write a query that selects records with dates in the current week (Sun to Sat). You'd think it would be remarkably simple...
14
by: Divit | last post by:
I want my code to tell me that (today) April 12th is the second wednesday of the month. And only thing I can find is the function to tell me what date belongs to the 2nd day in a given month and...
4
by: dgmoore | last post by:
I've hit a snag - I know this is easy, but the logic is escaping me. I need to set criteria in a query to find dates in a date field that lie between Tuesday of the current week and Tuesday of the...
0
by: Rudi Hausmann | last post by:
Hi! I have a column with a date. In another column I want to show the weekday of this date. I have following code: <asp:BoundField DataField="myDate" HeaderText="WeekDay"...
4
by: AdrianGawrys | last post by:
Can someone tell me why this query works: SELECT WeekdayName(Weekday(#17/02/2007#)-1) AS and this one doesnt SELECT WeekdayName(Weekday(#18/02/2007#)-1) AS what I am trying to achieve is to...
9
by: Dave | last post by:
What is the C# Equivalent to VB's Weekday function? I'm trying to convert this: Select Case Weekday(CurrentDate) Case 1 ' Sunday WKG = CurrentDate Case 2 ' Monday WKG = CurrentDate + 6 Case...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.