Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Determining the day of week

Status
Not open for further replies.

pnw

MIS
May 22, 2007
1
US
Hello,
Is there a way to determine the day of week (such as Monday, Tuesday, etc) based on a date in the following format of "2006-12-08 15:45:00"?

Thanks in advance!
 
Depending what you need to do try:
Code:
SELECT DATEPART(WEEKDAY, GETDATE())
SELECT DATENAME(WEEKDAY, GETDATE())
A note about DATEPART:
The weekday (dw) datepart returns a number that corresponds to the day of the week, for example: Sunday = 1, Saturday = 7. The number produced by the weekday datepart depends on the value set by SET DATEFIRST. This sets the first day of the week.

-Ryan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top