framework/utils/CTimestamp.php
protected static function digitCheck($y)
	{
		if ($y < 100){
			$yr = (integer) date("Y");
			$century = (integer) ($yr /100);

			if ($yr%100 > 50) {
				$c1 = $century + 1;
				$c0 = $century;
			} else {
				$c1 = $century;
				$c0 = $century - 1;
			}
			$c1 *= 100;
			// if 2-digit year is less than 30 years in future, set it to this century
			// otherwise if more than 30 years in future, then we set 2-digit year to the prev century.
			if (($y + $c1) < $yr+30) $y = $y + $c1;
			else $y = $y + $c0*100;
		}
		return $y;
	}
protected static function digitCheck($y)
	{
		if ($y < 100){
			$yr = (integer) date("Y");
			$century = (integer) ($yr /100);

			if ($yr%100 > 50) {
				$c1 = $century + 1;
				$c0 = $century;
			} else {
				$c1 = $century;
				$c0 = $century - 1;
			}
			$c1 *= 100;
			// if 2-digit year is less than 30 years in future, set it to this century
			// otherwise if more than 30 years in future, then we set 2-digit year to the prev century.
			if (($y + $c1) < $yr+30) $y = $y + $c1;
			else $y = $y + $c0*100;
		}
		return $y;
	}
protected static function digitCheck ( $ y ) { if ( $ y < 100 ) { $ yr = ( integer ) date ( "Y" ) ; $ century = ( integer ) ( $ yr / 100 ) ; if ( $ yr % 100 > 50 ) { $ c1 = $ century + 1 ; $ c0 = $ century ; } else { $ c1 = $ century ; $ c0 = $ century - 1 ; } $ c1 *= 100 ; // if 2-digit year is less than 30 years in future, set it to this century // otherwise if more than 30 years in future, then we set 2-digit year to the prev century. if ( ( $ y + $ c1 ) < $ yr + 30 ) $ y = $ y + $ c1 ; else $ y = $ y + $ c0 * 100 ; } return $ y ; }
Fix 2-digit years. Works for any century.
Assumes that if 2-digit is more than 30 years in future, then previous century.
@param integer $y year
@return integer change two digit year into multiple digits
Fix 2 - digit years . Works for any century . Assumes that if 2 - digit is more than 30 years in future then previous century .