Convert Day of Week Name to Day Number


SELECT CASE LEFt(DATENAME(DW,getdate()),3)
WHEN ‘Sun’ THEN 1
WHEN ‘Mon’ THEN 2
WHEN ‘Tue’ THEN 3
WHEN ‘Wed’ THEN 4
WHEN ‘Thu’ THEN 5
WHEN ‘Fri’ THEN 6
WHEN ‘Sat’ THEN 7
END WeekNum

Convert to week name from week number:

https://jingyangli.wordpress.com/2010/06/02/convert-day-of-week-number-to-day-name/

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