PHP

날짜

헤롱헤롱이 2020. 5. 6. 18:50
$last = date("t", strtotime($year."-".$month."-01 00:00:00")); //해당달의 마지막 날짜한달전
$start = date("Y-m-01", strtotime("-1 month", time()));
$end = date("Y-m-".date("t", strtotime($start)), strtotime("-1 month", time()));

//시작일~~종료일 출력
$start =  strtotime($sc["sc_date_start"]);
$end = strtotime($sc["sc_date_end"]);
while ($start <= $end)
{      
	echo date('Y-m-d-D', $start);    
    echo '<br>';       
    $start = strtotime("+1 day",$start);
 }
 
 //옵션 30분단위로 출력
 $store = sql_fetch(" SELECT * FROM g5_store WHERE st_id = '{$_POST["stId"]}' ");
 $start = $store["st_start_time"].":00";
 $end = $store["st_end_time"].":00";
 $tStart = strtotime($start);
 $tEnd = strtotime($end);
 $tNow = $tStart;
 $skipTime = strtotime('+1 hours', time());
<?php while($tNow <= $tEnd) : ?>
<?php if($_POST["picDate"] == date("Y-m-d")) : ?>
<?php    
if($skipTime > $tNow)
{        
$tNow = strtotime('+30 minutes',$tNow);
continue; 
}
?>
<?php endif; ?>
<option value="<?= date("H:i",$tNow) ?>"><?= date("H:i",$tNow) ?></option>
<?php
$tNow = strtotime('+30 minutes',$tNow);
endwhile; 
?>
<?php if(!$store) : ?>
<option value="">시간선택</option>
<?php endif;?>