Get first day & last day date of provided date in SQL
We are calculating first day & the last day of giving month date. Most of the SQL procedures are using date validation, hope this query will helpful for you.
Last Day Of Month
First Day Of Month
Last Day Of Month
DECLARE @date DATETIME SET @date='2015-03-04' SELECT DATEADD(dd, -DAY(DATEADD(m,1,@date)), DATEADD(m,1,@date)) AS LastDayOfMonth
DECLARE @date DATETIME SET @date='2015-03-04' SELECT DATEADD(dd,-(DAY(@date)-1),@date) AS FirstDayOfMonth
0 comments :
Post a Comment