EnjoySharePoint YouTube Channel

Get weekday name in sql server 2008

In this post we will discuss how to get the weekday name in sql server 2008. Also you can check my previous posts on:
By using the DATEPART() function we can get the weekday name. The DATEPART() function is used to return a single part of a date or time, such as year, quarter, month, day, week, weekday, hour, minute, second, millisecond etc.
Here DATEPART() tooks two parameter like below:
DATEPART ( datepart , date )
For datepart parameter values check this msdn article.
date: valid date or datetime expression.
Below is the query that will return weekday name, like if today is friday it will return friday.
      Declare @week int
      Set @week=Datepart(dw,GetDate())
      Select case @week
      When 1 then ‘Sunday’
      When 2 then ‘Monday’
      When 3 then ‘Tuesday’
      When 4 then ‘Wednesday’
      When 5 then ‘Thursday’
      When 6 then ‘Friday’
      Else ‘Saturday’
Out put:
Check out Best Alternative to InfoPath -> Try Now
You May Also like the Following SharePoint Tutorials:

About Bijay Kumar

I am Bijay from Odisha, India. Currently working in my own venture TSInfo Technologies in Bangalore, India. I am Microsoft Office Servers and Services (SharePoint) MVP (5 times). I works in SharePoint 2016/2013/2010, SharePoint Online Office 365 etc. Check out My MVP Profile.. I also run popular SharePoint web site SharePointSky.com

View all posts by Bijay Kumar →