format("n"); $currentQuarter = self::Q1; if ($currentMonth >= self::Q2_START && $currentMonth <= self::Q2_END) { $currentQuarter = self::Q2; } if ($currentMonth >= self::Q3_START && $currentMonth <= self::Q3_END) { $currentQuarter = self::Q3; } if ($currentMonth >= self::Q4_START && $currentMonth <= self::Q4_END) { $currentQuarter = self::Q4; } return $currentQuarter; } /** * Gets start date of quarter * @param int $quarter * @param int $year * @return string */ public static function getStartDate($quarter, $year) { $startMonth = constant("self::Q".$quarter."_START"); $startDate = Date::createFromTimestamp(mktime(0, 0, 0, $startMonth, 1, $year)); $startDateString = $startDate->toString(); return $startDateString; } /** * Gets end date of quarter * @param int $quarter * @param int $year * @return string */ public static function getEndDate($quarter, $year) { $date = Date::createFromTimestamp(\MakeTimeStamp(self::getStartDate($quarter, $year))); $date->add("3 months"); return $date->toString(); } }