Skip to content

Commit

Permalink
Clean up toQuarter()
Browse files Browse the repository at this point in the history
  • Loading branch information
bcrowe committed Nov 13, 2013
1 parent 91d40e0 commit d012cc8
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Cake/Utility/Time.php
Expand Up @@ -568,14 +568,14 @@ public static function isTomorrow($dateString, $timezone = null) {
*/
public static function toQuarter($dateString, $range = false) {
$dateTime = new \DateTime;
$timeStamp = $dateTime->setTimestamp(static::fromString($dateString));
$dateTime->setTimestamp(static::fromString($dateString));

$quarter = ceil($timeStamp->format('m') / 3);
$quarter = ceil($dateTime->format('m') / 3);
if ($range === false) {
return $quarter;
}

$year = $timeStamp->format('Y');
$year = $dateTime->format('Y');
switch ($quarter) {
case 1:
return array($year . '-01-01', $year . '-03-31');
Expand Down

0 comments on commit d012cc8

Please sign in to comment.