There are certain cases where you need to get the the name of the week number or name. On Sql Server we have some functions that can help us.
You can check the following functions that can help with this task.
This function returns an string that represents the specified datepart for a given date.
DATENAME ( datepart , date )
For this case where we need to get the name of the weekday, we are going to use the following argument.
SELECT DATENAME (dw , GETDATE());
This returns the current date day name, This name match current day as I am executing this query on Sunday.
Day name is in english as our database language is english, if you want to return day’s name in another language you should use
SET LANGUAGE LanguageName;
This function returns a value formatted with an specified format. This function works for formatting date/time and number values as strings.
FORMAT( value, format [, culture ] )
For this example we are going to use ‘dddd’ on format as this syntax is used for getting the name of the day.
SELECT FORMAT(GETDATE(), 'dddd');