In
this article I am going to explain how to get first and last date with week day
name of month in Sql Server.
In
the previous article I have explained SQL SERVER Query to get week day name, howto Get week day name and month name of current date, Move selected item or allitems from one checkboxlist to another and Get the URL (address) of currentpage code behind.
Implementation:
Run
the below given Sql server query to Get Week day name and date of month.
Declare @CurrentDate DATE,@FirstDay DATE,@LastDay DATE
Set @CurrentDate =
getdate()
Set @FirstDay=(SELECT DATEADD(dd ,-(DAY(@CurrentDate )-1),@CurrentDate ))
Set @LastDay=(SELECT DATEADD(dd ,-(DAY(@CurrentDate )), DATEADD(MONTH,1,@CurrentDate )))
SELECT [Week Day on First Date]=datename(dw,@FirstDay)
,[First Date of Month] =
@FirstDay
,[Week day on Last date]=datename(dw,@LastDay)
,[Last Date of Month]=@LastDay
Result:
0 Comments