[제나플러스] 기간별 날짜 계산
페이지 정보
본문
<?php
$todaytime = date("Y-m-d");
$day1 = $list[$i][wr_7];
$day2 = $list[$i][wr_9];
$today = strtotime($todaytime);
$c_day1 = strtotime($day1);
$c_day2 = strtotime($day2);
$gap = $c_day1 - $today;
$gap1 = $c_day2 - $today;
$o_day = (int)($gap / 86400);
$o_day1 = (int)($gap1 / 86400);
if ($o_day < "0") {
$o_day = "";
}elseif ($o_day > "0" && $o_day <= "30") {
$o_day = "<font color='#FF0000'><strong>({$o_day})</strong></font>";
}elseif ($o_day > "30" && $o_day <= "60") {
$o_day = "<font color='#0000ff'><strong>({$o_day})</strong></font>";
}elseif ($o_day > "60") {
$o_day = "({$o_day})";
}
if ($o_day1 < "0") {
$o_day1 = "";
}elseif ($o_day1 > "0" && $o_day1 <= "30") {
$o_day1 = "<font color='#FF0000'><strong>({$o_day1})</strong></font>";
}elseif ($o_day1 > "30" && $o_day1 <= "60") {
$o_day1 = "<font color='#0000ff'><strong>({$o_day1})</strong></font>";
}elseif ($o_day1 > "60") {
$o_day1 = "({$o_day1})";
}
?>
$todaytime = date("Y-m-d");
$day1 = $list[$i][wr_7];
$day2 = $list[$i][wr_9];
$today = strtotime($todaytime);
$c_day1 = strtotime($day1);
$c_day2 = strtotime($day2);
$gap = $c_day1 - $today;
$gap1 = $c_day2 - $today;
$o_day = (int)($gap / 86400);
$o_day1 = (int)($gap1 / 86400);
if ($o_day < "0") {
$o_day = "";
}elseif ($o_day > "0" && $o_day <= "30") {
$o_day = "<font color='#FF0000'><strong>({$o_day})</strong></font>";
}elseif ($o_day > "30" && $o_day <= "60") {
$o_day = "<font color='#0000ff'><strong>({$o_day})</strong></font>";
}elseif ($o_day > "60") {
$o_day = "({$o_day})";
}
if ($o_day1 < "0") {
$o_day1 = "";
}elseif ($o_day1 > "0" && $o_day1 <= "30") {
$o_day1 = "<font color='#FF0000'><strong>({$o_day1})</strong></font>";
}elseif ($o_day1 > "30" && $o_day1 <= "60") {
$o_day1 = "<font color='#0000ff'><strong>({$o_day1})</strong></font>";
}elseif ($o_day1 > "60") {
$o_day1 = "({$o_day1})";
}
?>
추천0
댓글목록
등록된 댓글이 없습니다.