5분마다 실행되는 게임이 남은 시간 계산하기

5분마다 실행되는 게임이 남은 시간 계산하기

더시민 1 432 0

 5/10/15/20/25/30/35/40/45/55/00

//남은시간
$min = date("i");
echo "<br>";
//echo $min = preg_replace('/(0)(\d)/','$2', $min);  //01234~59
if($min >=55) {
    $gap_string = date("Y-m-d H").":00:00";
    
    $next = strtotime($gap_string." +1 hours");
} else {
    $diff = @intval($min/5);
    $gap_string = date("Y-m-d H").":".sprintf('%02d',($diff+1)*5).":00";
    $next = strtotime($gap_string);
}
echo $diff;
echo "<br>";
echo $gap_string;
echo "<br>";
echo $next;
echo "<br>";
echo date("Y-m-d H:i:s",$next);

1 Comments
더시민 04.22 20:00  
//남은시간
$min = date("i");
//echo $min = preg_replace('/(0)(\d)/','$2', $min);  //01234~59
if($min >=55) {
$gap_string = date("Y-m-d H").":00:00";

$next = strtotime($gap_string." +1 hours");
} else {
$diff = @intval($min/5);
$gap_string = date("Y-m-d H").":".sprintf('%02d',($diff+1)*5).":00";
$next = strtotime($gap_string);
}
$reminning = $next-strtotime("Now");
/*
echo $diff;
echo "<br>";
echo $gap_string;
echo "<br>";
echo $next;
echo "<br>";
echo date("Y-m-d H:i:s",$next);
echo "<br>";
*/
제목
Category
Facebook Twitter GooglePlus KakaoStory KakaoTalk NaverBand