PHPize Online / SQLize Online  /  SQLtest Online

A A A
Share      Blog   Popular
Copy Format Clear
Copy Clear
Copy Format Clear
<?php $current_month = date('m'); $current_quarter_start = ceil($current_month/4)*3+1; // get the starting month of the current quarter echo $start_date = date("Y-m-d H:i:s", mktime(0, 0, 0, $current_quarter_start, 1, date('Y') )); echo $end_date = date("Y-m-d H:i:s", mktime(0, 0, 0, $current_quarter_start+3, 1, date('Y') )); // by adding or subtracting from $current_quarter_start within the mktime function you can get any quarter of any year you want. // return array($start_date, $end_date); // print_r($months);
Show:  
Copy Clear