생일날짜 카운터 (남은 날수혹은 지난 날수 계산)

응용 : 결혼기념일 등 각종 기념일 체크

생일날짜를 계산해 줍니다.

남은 날이 10일이면 -10으로, 지난 날이 10일이면 10으로 값이 얻어집니다.

아래는 제대로 동작하지 않지만 그 방법을 보여주는 PHP스크립트 입니다.
(몇줄 주석처리 되어 있는 부분을 회복시키고 테스트 해보세요.)

// BIRTHDAY Counter
list($today_count,$year)=explode(” “,date(“z Y”));

#############################################
# list($mon,$day)=explode(” “,”10 25 1975”);
# list($mon,$day)=explode(” “,”01 01 1975”);
$day_count=date(“z”,mktime(0,0,0,$mon,$day,$year));

$check_counter=$today_count-$day_count;
# echo “$check_counter
“;
if ($check_counter > 233) {
#올해의 전체 일수를 뺀다.
$year_day=date(“z”,mktime(0,0,0,12,31,$year))+1;
$check_counter-=$year_day;
} elseif ($check_counter < -233) {
#작년의 전체 일수를 더한다.
$year_day=date(“z”,mktime(0,0,0,12,31,$year-1))+1;
$check_counter+=$year_day;
}
# echo “$check_counter
“;
# echo date(“z”,mktime(0,0,0,12,31,$year-2))+1;
?>

이상입니다.