Sql server: Get week day name and month name of current date

In this article I am going to explain how to get week day name and month name of current or given date in sql server.

Implementation:

To get the week day name and month name of current date run the below given query in Sql server:

declare @currentDate datetime
set @currentDate = getdate()
select @currentDate as Todaydate,datename(dw,@currentDate) as WeekDay,
datename(month,@currentDate) as MonthName,datepart(yyyy,@currentDate) as Year

Result:
Sql server: Get week day name and month name of current date

To get the week day name and month name for given date run the below given query in Sql server:

declare @currentDate datetime
set @currentDate = '20160101'
select @currentDate as Todaydate,datename(dw,@currentDate) as WeekDay,

datename(month,@currentDate) as MonthName,datepart(yyyy,@currentDate) as Year

Result:
Sql server: Get week day name and month name of current date

Post a Comment

0 Comments