protected function getDay($date, $pattern = 'd')
{
$day = $date['mday'];
switch ($pattern) {
case 'd':
return $day;
case 'dd':
return str_pad($day, 2, '0', STR_PAD_LEFT);
default:
throw new Exception('The pattern for day of ' . 'the month is "d" or "dd".');
}
}