/** * Get the era. i.e. in gregorian, year > 0 is AD, else BC. * @todo How to support multiple Eras?, e.g. Japanese. * @param array getdate format. * @param string a pattern. * @return string era */ protected function getEra($date, $pattern = 'G') { if ($pattern != 'G') { throw new Exception('The pattern for era is "G".'); } $year = $date['year']; if ($year > 0) { return $this->formatInfo->getEra(1); } else { return $this->formatInfo->getEra(0); } }