Wednesday, May 13, 2020

QTD quarter date from and to

DECLARE @tDate DATETIME
SET @tDate = GETDATE()
 
SELECT @tDate AS 'Input Date',
  DATEADD(q, DATEDIFF(q, 0, @tDate ), 0)
                        AS 'frmDate',      
  DATEADD(d, -1, DATEADD(q, DATEDIFF(q, 0, @tDate ) + 1, 0))
                        AS 'toDate'


No comments: