Created
July 10, 2015 18:38
-
-
Save hasokeric/c8e07c87562202328474 to your computer and use it in GitHub Desktop.
PHP Get Quarterly Date Start and End
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function get_quarter_dates_array($quarter) | |
{ | |
$date_start = "%Y-01-01"; | |
$date_end = "%Y-03-31"; | |
switch ($quarter) | |
{ | |
case 1: | |
$date_start = "%Y-01-01"; | |
$date_end = "%Y-03-31"; | |
break; | |
case 2: | |
$date_start = "%Y-04-01"; | |
$date_end = "%Y-06-31"; | |
break; | |
case 3: | |
$date_start = "%Y-07-01"; | |
$date_end = "%Y-09-31"; | |
break; | |
case 4: | |
$date_start = "%Y-10-01"; | |
$date_end = "%Y-12-31"; | |
break; | |
default: | |
break; | |
} | |
return ['start' => $date_start, 'end' => $date_end]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment