I am trying to set a start date and end date by the quarter.
For example, I am working on a reporting system where i need to report data for quarter 1, quarter 2, qu
I'm not sure why this is so difficult - several solutions were really close here but were failing to find the FIRST and LAST day of a quarter. Quarters don't end on the first!
Modified from KLOZ above:
$current_quarter = ceil(date('n') / 3);
$first_day_of_this_quarter = date('m/d/Y', strtotime(date('Y').'-'.(($current_quarter*3)-2).'-1'));
$last_day_of_this_quarter = date('m/d/Y', strtotime(date('Y').'-'.($current_quarter*3).'-'.(date("t",date('Y').'-'.($current_quarter*3).'-1'))));