GetQuarter();
public static int GetQuarter(int month) { return month <= 3 ? 1 : ((month >= 4) && (month <= 6) ? 2 : ((month >= 7) && (month <= 9) ? 3 : 4)); }
GetQuarter();
public static int GetQuarter(int month) { return month <= 3 ? 1 : ((month >= 4) && (month <= 6) ? 2 : ((month >= 7) && (month <= 9) ? 3 : 4)); }
Another way to get the same result is:
return Math.Ceiling(month / 3D);
Thanks Phil, nice one!