App\Libraries\Utils::getQuarter PHP Method

getQuarter() private static method

private static getQuarter ( $offset )
    private static function getQuarter($offset)
    {
        $month = intval(date('n')) - 1;
        $quarter = floor(($month + 3) / 3);
        $quarter += $offset;
        $quarter = $quarter % 4;
        if ($quarter == 0) {
            $quarter = 4;
        }
        return 'Q' . $quarter;
    }

Usage Example

Ejemplo n.º 1
0
 private static function getDatePart($part, $offset)
 {
     $offset = intval($offset);
     if ($part == 'MONTH') {
         return Utils::getMonth($offset);
     } elseif ($part == 'QUARTER') {
         return Utils::getQuarter($offset);
     } elseif ($part == 'YEAR') {
         return Utils::getYear($offset);
     }
 }