Hi,
I need to calculate current quarter and fiscal quarter in my Sql query.
I have a column for DateTime Datatype.
I need to find out Current Quarter Name like Q12012, Q22012, Q32012, Q42012 and Fiscal Quarter Name as well.
Now Fiacal Year starts from 1st April, and Current Quarter starts from 1st Jan.
For Current Quarter of 2012
- Jan-Mar = Q12012
- Apr-Jun = Q22012
- Jul-Sep = Q32012
- Oct-Dec = Q42012
For Fiscal Quarter of 2012 ( starts from 1st Apr, 2011 )
- Apr2011-Jun2011 = Q12012
- Jul2011-Sep2011 = Q22012
- Oct2011-Dec2011 = Q32012
- Jan2011-Mar2012 = Q42012
means if its 1st April, 2012,
- its a new Fiacal Year 2013 so Fiacal Quarter Name should be Q12013
- and its Current Quarter Name should be Q22012
Can you help me to calculate this in a select query for given dates?
Thanks in advance,
Nirav