/*
* To get Current Quarter of the Year
*/
function current_quarter($n){
$currentQuarter = 0;
if($n < 4){
$currentQuarter = "01-01-".date('Y')." to 31-03-".date('Y')."";
} elseif($n > 3 && $n <7){
$currentQuarter = "01-04-".date('Y')." to 30-06-".date('Y')."";
} elseif($n >6 && $n < 10){
$currentQuarter = "01-07-".date('Y')." to 30-09-".date('Y')."";
} elseif($n >9){
$currentQuarter = "01-10-".date('Y')." to 31-12-".date('Y')."";
}
return $quarter = explode(" to ", $currentQuarter);
}
echo $quarter_date = current_quarter(date('n'));
No comments:
Post a Comment