Select Date Name from Day

http://wardyit.com/blog/blog/archive/2005/11/02/51.aspx

Date for Monday and Friday of Current Week
The Date for Monday and Friday of the current week can be determined as illustrated below.

SELECT GETDATE() + (2 – DATEPART(WEEKDAY, GETDATE())) AS MONDAY, GETDATE() + (6 – DATEPART(WEEKDAY, GETDATE())) AS FRIDAY

This assumes that you consider the first day of the week to be a Sunday and that the last day of the week is a Saturday. If this is not the case you will need to use the SET DATEFIRST to set the first day of the week to a number from 1 through 7. ie. SET DATEFIRST 1 to set MONDAY. To determine the day that is currently set as the first day of the week run SELECT @@DATEFIRST (by default this is 7 which is Sunday).

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s