/////////////
declare @Year int=2020, @Month int=1
Select 'Month Name : '+ DateName( month , DateAdd( month , @Month , 0 ) - 1 )
select cast(dateadd(month, @Month - 1, dateadd(year, @Year - 1900, 0)) as date) [Start Date],
cast(dateadd(month, @Month,dateadd(year, @Year - 1900, -1)) as date) [End Date]
////////////////// Result
Month Name : January
Start Date End Date
2020-01-01 2020-01-31
No comments:
Post a Comment