Find Start Day of Current Month using EOMONTH() in SQL Server 2012

Bandi
Posted by Bandi under Sql Server category on | Points: 40 | Views : 394
We can use EOMONTH along with DATEADD to find out First Day of given/current month. Below is the SQL query used for this calculation. It will be more useful whenever we supposed to calculate Effective & Expiration dates

DECLARE @GivenDate AS DATETIME = GETDATE()
SELECT DATEADD(DAY, 1, EOMONTH(@GivenDate, -1)) AS 'Current Month Start Date'


OutPut
GivenDate	         Current Month Start Date 
2015-03-20 12:39:34.277 2015-03-01

Comments or Responses

Login to post response