If you prefer short and concise solutions without branching and arrays, here is my preferred solution.
Normal Quarter:
public static int GetQuarter(this DateTime date)
{
return (date.Month + 2)/3;
}
Financial Year Quarter:
public static int GetFinancialQuarter(this DateTime date)
{
return (date.AddMonths(-3).Month + 2)/3;
}
Integer division will truncate decimals, giving you an integer result. Place methods into a static class and you will have an extension method to be used as follows:
date.GetQuarter()
date.GetFinancialQuarter()
See dotnetfiddle