Get Months First and Last Date in SQl

We just need to pass a particular date in this query to get months first and last date of that passed particular date.

SELECT @mydate = GETDATE()


SELECT CONVERT(VARCHAR(25),DATEADD(dd,-(DAY(@mydate)-1),@mydate),101) AS Date_Value,
‘First Day of Month’ AS Date_Type

SELECT CONVERT(VARCHAR(25),DATEADD(dd,-(DAY(DATEADD(mm,1,@mydate))),DATEADD(mm,1,@mydate)),101) ,
‘Last Day of Month’

Reference :  (

Posts Tagged with…

Write a Comment

Your email address will not be published. Required fields are marked *