framework/i18n/CDateFormatter.php
protected function formatEra($pattern,$date)
	{
		$era=$date['year']>0 ? 1 : 0;
		switch($pattern)
		{
			case 'G':
			case 'GG':
			case 'GGG':
				return $this->_locale->getEraName($era,'abbreviated');
			case 'GGGG':
				return $this->_locale->getEraName($era,'wide');
			case 'GGGGG':
				return $this->_locale->getEraName($era,'narrow');
			default:
				throw new CException(Yii::t('yii','The pattern for era must be "G", "GG", "GGG", "GGGG" or "GGGGG".'));
		}
	}
protected function formatEra($pattern,$date)
	{
		$era=$date['year']>0 ? 1 : 0;
		switch($pattern)
		{
			case 'G':
			case 'GG':
			case 'GGG':
				return $this->_locale->getEraName($era,'abbreviated');
			case 'GGGG':
				return $this->_locale->getEraName($era,'wide');
			case 'GGGGG':
				return $this->_locale->getEraName($era,'narrow');
			default:
				throw new CException(Yii::t('yii','The pattern for era must be "G", "GG", "GGG", "GGGG" or "GGGGG".'));
		}
	}
protected function formatEra ( $ pattern , $ date ) { $ era = $ date [ 'year' ] > 0 ? 1 : 0 ; switch ( $ pattern ) { case 'G' : case 'GG' : case 'GGG' : return $ this -> _locale -> getEraName ( $ era , 'abbreviated' ) ; case 'GGGG' : return $ this -> _locale -> getEraName ( $ era , 'wide' ) ; case 'GGGGG' : return $ this -> _locale -> getEraName ( $ era , 'narrow' ) ; default : throw new CException ( Yii :: t ( 'yii' , 'The pattern for era must be "G", "GG", "GGG", "GGGG" or "GGGGG".' ) ) ; } }
Get the era. i.e. in gregorian, year > 0 is AD, else BC.
@param string $pattern a pattern.
@param array $date result of {@link CTimestamp::getdate}.
@throws CException if "era" pattern is unknown
@return string era
@todo How to support multiple Eras?, e.g. Japanese.
Get the era . i . e . in gregorian year > 0 is AD else BC .