This simple query will give you the firstday of the current month, you can change the date to get the first day of the given month.
SELECT CONVERT(VARCHAR(25),DATEADD(dd,-(DAY(getdate())-1),getdate()),101) AS First_Day
Instead of getdate() you can pass any date.
This simple query will give you the last day of the current month, you can change the date to get the lastday of the given month.
SELECT DATEADD(s,-1,DATEADD(mm, DATEDIFF(m,0,GETDATE())+1,0))
Instead of getdate() you can pass any date.
No comments:
Post a Comment