> The Script:
DECLARE @Today DateTime
SET @Today = GETDATE()
-- First day of the month:
SELECT [First day of the month] = DATEADD(D, -1, DATEADD(MM, DATEDIFF(m, 0, @Today), 1 ))
-- Last day of the month:
SELECT [Last day of the month] = DATEADD(S, -1, DATEADD(MM, DATEDIFF(m, 0, @Today) + 1, 0))
DECLARE @Today DateTime
SET @Today = GETDATE()
-- First day of the month:
SELECT [First day of the month] = DATEADD(D, -1, DATEADD(MM, DATEDIFF(m, 0, @Today), 1 ))
-- Last day of the month:
SELECT [Last day of the month] = DATEADD(S, -1, DATEADD(MM, DATEDIFF(m, 0, @Today) + 1, 0))
Comments
Post a Comment