여분필드 wr_10으로 시작일 만드는 소스 문의 드립니다. 채택완료
안녕하세요..고수님들
초보자가 질문 드립니다.
아래 코드에는 마감일이 있는데요.. 여분필드 wr_10을 이용해서 시작일을 만들고 싶어서 마감일 코드를 복사해서 붙여 넣기를 해서 만들어 봐도 영 안 됩니다. 어디부터 어디까지 수정해야 해야 하는지 한 수 가르침 부탁드립니다.
</strong></p>
<p><?php
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가</p>
<p>include_once(G5_PLUGIN_PATH.'/jquery-ui/datepicker.php');</p>
<p>if ($w == '') {
$write['as_update'] = date("Y-m-d 23:00:00", G5_SERVER_TIME + 86400 * 10);
}</p>
<p>$edate = date("Y-m-d", strtotime($write['as_update']));
$ehour = date("H", strtotime($write['as_update']));</p>
<p>$harr = array("00", "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "13", "14", "15", "16" , "17", "18", "19", "20", "21", "22", "23");</p>
<p>
<strong> <div class="form-group">
<label class="col-sm-2 col-xs-12 control-label" for="edate">마감일</label>
<div class="col-sm-3 col-xs-6">
<div class="control-label input-group input-group-sm">
<input type="text" name="edate" value="<?php echo $edate; ?>" id="edate" class="form-control input-sm" size="10" maxlength="10">
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
</div>
</div>
<div class="col-sm-3 col-xs-6">
<div class="control-label input-group input-group-sm">
<select id="ehour" name="ehour" class="form-control input-sm">
<?php
for($i=0; $i < count($harr); $i++) {
$selected = ($harr[$i] == $ehour) ? ' selected' : '';
echo '<option value="'.$harr[$i].'"'.$selected.'>'.$harr[$i].'</option>'.PHP_EOL;
}
?>
</select>
<span class="input-group-addon">시</span>
</div>
</div>
</div></strong>
<script>
$(function(){
$("#edate").datepicker({ changeMonth: true, changeYear: true, dateFormat: "yy-mm-dd", showButtonPanel: true });
$("#wr_content").addClass("form-control input-sm write-content");
});
</script></p>
<p><strong>
답변 2개
</p>
<p><?php
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
include_once(G5_PLUGIN_PATH.'/jquery-ui/datepicker.php');</p>
<p>if ($w == '') {
$write['as_update'] = date("Y-m-d 23:00:00", G5_SERVER_TIME + 86400 * 10);
}</p>
<p>$edate = date("Y-m-d", strtotime($write['as_update']));
$ehour = date("H", strtotime($write['as_update']));
$harr = array("00", "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "13", "14", "15", "16" , "17", "18", "19", "20", "21", "22", "23");</p>
<p>// 시작일 생성
if (!empty($write['wr_10'])) {
$sdate = date("Y-m-d", strtotime($write['wr_10']));
$shour = date("H", strtotime($write['wr_10']));
} else {
$sdate = date("Y-m-d");
$shour = date("H");
}</p>
<p>?></p>
<p><div class="form-group">
<label class="col-sm-2 col-xs-12 control-label" for="sdate">시작일</label>
<div class="col-sm-3 col-xs-6">
<div class="control-label input-group input-group-sm">
<input type="text" name="sdate" value="<?php echo $sdate; ?>" id="sdate" class="form-control input-sm" size="10" maxlength="10">
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
</div>
</div>
<div class="col-sm-3 col-xs-6">
<div class="control-label input-group input-group-sm">
<select id="shour" name="shour" class="form-control input-sm">
<?php
for($i=0; $i < count($harr); $i++) {
$selected = ($harr[$i] == $shour) ? ' selected' : '';
echo '<option value="'.$harr[$i].'"'.$selected.'>'.$harr[$i].'</option>'.PHP_EOL;
}
?>
</select>
<span class="input-group-addon">시</span>
</div>
</div>
</div></p>
<p><div class="form-group">
<label class="col-sm-2 col-xs-12 control-label" for="edate">마감일</label>
<div class="col-sm-3 col-xs-6">
<div class="control-label input-group input-group-sm">
<input type="text" name="edate" value="<?php echo $edate; ?>" id="edate" class="form-control input-sm" size="10" maxlength="10">
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
</div>
</div>
<div class="col-sm-3 col-xs-6">
<div class="control-label input-group input-group-sm">
<select id="ehour" name="ehour" class="form-control input-sm">
<?php
for($i=0; $i < count($harr); $i++) {
$selected = ($harr[$i] == $ehour) ? ' selected' : '';
echo '<option value="'.$harr[$i].'"'.$selected.'>'.$harr[$i].'</option>'.PHP_EOL;
}
?>
</select>
<span class="input-group-addon">시</span>
</div>
</div>
</div></p>
<p><script>
$(function(){
$("#sdate").datepicker({ changeMonth: true, changeYear: true, dateFormat: "yy-mm-dd", showButtonPanel: true });
$("#edate").datepicker({ changeMonth: true, changeYear: true, dateFormat: "yy-mm-dd", showButtonPanel: true });
$("#wr_content").addClass("form-control input-sm write-content");
});
</script>
답변에 대한 댓글 2개
댓글을 작성하려면 로그인이 필요합니다.
답변에 대한 댓글 4개
마지막으로 목록에서 날짜가 2023-06-26 00:00:00 처럼 나오는데요.. 뒤에 00:00:00 시간 부분을 잘라내고 싶어요...
이렇게 해 보세요.
<?php echo mb_substr($list[$i]['wr_10'],0,10); ?> 이런 것도 있길래 적용해 보니 동일한 데이터가 출력 됩니다.
오늘 너무 감사했습니다.
mb_substr 은 글자를 자르는 함수 입니다. 날짜포맷 함수를 사용 하세요.
댓글을 작성하려면 로그인이 필요합니다.
답변을 작성하려면 로그인이 필요합니다.
로그인
리스트와 목록에서 <?php echo ($view['wr_10']); ?> 처럼 불러 오면 되는지요??