[Solved] get quarter of current date in sql server 2008 [closed]


You can use datepart if you have quarters specified as 1,2,3 and 4 as:

declare @date date = getdate()

select case when  datepart(MM, @date) IN (4,5,6) then 'Q1' 
            when  datepart(MM, @date) IN (7,8,9) then 'Q2'
            when  datepart(MM, @date) IN (10,11,12) then 'Q3' 
            when  datepart(MM, @date) IN (1,2,3) then 'Q4' 
       end as Quater

solved get quarter of current date in sql server 2008 [closed]