<?
function getTimeCheck($timestr) {
$date = $timestr;
$year = substr($date, 0, 4);
$mon = substr($date, 5, 7);
$day = substr($date, 8, 10);
$hour = substr($date, 11, 13);
$min = substr($date, 14, 16);
$sec = substr($date, 17);
$check = mktime() - mktime($hour, $min, $sec, $mon, $day, $year);
$check = $check / 60 / 60 / 24;
// $check가 1보다 작으면 $new = true!
if($check<1) $new = 1;
else $new = 0;
return $new;
}
// 위와 같이 실행된다. strTotime(초단위) 함수 적용
function getTimeCheck($timestr) {
$check = mktime() - strTotime($timestr);
$check = $check / 60 / 60 / 24;
// $check가 1보다 작으면 $new = true!
if ($check < 1) $new = 1;
else $new = 0;
return $new;
}
// 사용예: 하루 안의 글에 new 표시
$new = getTimeCheck($row[regdate]);
if ($new == 1) echo "<img src = './images/new.gif'>";
?>