public compareMonth ( |
||
$date | Month to compare | |
리턴 | integer | Returns `0` if the current month is equal to `$date`'s, `-1` if the current month is earlier or `1` if the current month is later. |
public function compareMonth(Date $date)
{
$currentMonth = date('n', $this->getTimestamp());
$toCompareMonth = date('n', $date->getTimestamp());
if ($currentMonth == $toCompareMonth) {
return 0;
}
if ($currentMonth < $toCompareMonth) {
return -1;
}
return 1;
}