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
Some answers are way too complicated IMO
public function getStartOfQuarter() { return date(sprintf('Y-%s-01', floor((date('n') - 1) / 3) * 3 + 1)); } public function getEndOfQuarter() { return date(sprintf('Y-%s-t', floor((date('n') + 2) / 3) * 3)); }