protected function digitCheck($y)
{
if ($y < 100) {
$yr = (int) date("Y");
$century = (int) ($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;
}