Query the SQL statement declare @ date & nbsp; datetimeset @ dategetdate () at the beginning of a quarter. Calculate the first day of the quarter where the given date is located, selectdateadd (quarter, datediff (quarter, 0, @ date), 0) as the first day of the current quarter-end of the quarter, calculate the last day of the quarter where the given date is located selectdate to query the end of the quarter, SQL statement at the beginning of the last quarter of the year
Declare @ date datetime
Set @ date = getdate ()
-- Calculate the first day of the quarter of the given date at the beginning of the quarter
Select dateadd (quarter, datediff (quarter, 0, @ date), 0) as 'first day of the current quarter'
-- Calculate the last day of the quarter of the given date at the end of the quarter
Select dateadd (quarter, 1 + datediff (quarter, 0, @ date),-1) as 'last day of the current quarter'
-- Beginning of last quarter
Select dateadd (quarter, datediff (quarter, 0, @ date)-1, 0) as 'beginning of the last quarter of the current quarter'
-- End of the last quarter
Select dateadd (quarter, datediff (quarter, 0, @ date),-1) as 'end of last quarter of the current quarter'
-- Beginning of next quarter
Select dateadd (quarter, 1 + datediff (quarter, 0, @ date), 0) as 'beginning of the next quarter of the current quarter'
-- End of next quarter
Select dateadd (quarter, 2 + datediff (quarter, 0, @ date),-1) as 'end of next quarter of the current quarter'
Go