How to get the quarter of the year from a date parameter

Declare @AsOfDate Date='04/30/2013'

Select Cast(((MONTH(@AsOfDate)-1)/3) as int)+1 as Quarter
--or
SELECT DATENAME(quarter, @AsOfDate)

Related Posts

Comments are closed.


Warning: Use of undefined constant XML - assumed 'XML' (this will throw an Error in a future version of PHP) in /homepages/35/d428352912/htdocs/WilliamMendoza/wp-content/plugins/wp-syntaxhighlighter/wp-syntaxhighlighter.php on line 1048