PHP provides ways to get the number of the current day of the month (date(\'j\')) as well as the number of the current day of the year (date(\'z\')). Is there a way to get the n
function date_quarter() { return ceil(date('n', time()) / 3); }
or
function date_quarter() { $month = date('n'); if ($month <= 3) return 1; if ($month <= 6) return 2; if ($month <= 9) return 3; return 4; }