테스트 사이트 - 개발 중인 베타 버전입니다

여분필드 wr_10으로 시작일 만드는 소스 문의 드립니다. 채택완료

메너 2년 전 조회 1,177

안녕하세요..고수님들

초보자가 질문 드립니다.

 

아래 코드에는 마감일이 있는데요.. 여분필드 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개

채택된 답변
+20 포인트
들레아빠

</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개

메너
2년 전
관심 주셔서 감사합니다.
리스트와 목록에서 <?php echo ($view['wr_10']); ?> 처럼 불러 오면 되는지요??
들레아빠
2년 전
채택 감사 합니다.

댓글을 작성하려면 로그인이 필요합니다.

들레아빠

리스트에서는 <?php echo $list[$i]['wr_10'] ?> 하면 나올겁니다.

로그인 후 평가할 수 있습니다

답변에 대한 댓글 4개

메너
2년 전
아..너무 감사합니다. 출력 잘 됩니다.
마지막으로 목록에서 날짜가 2023-06-26 00:00:00 처럼 나오는데요.. 뒤에 00:00:00 시간 부분을 잘라내고 싶어요...
들레아빠
2년 전
[code]<?php echo date("y-m-d", strtotime($list[$i]['wr_10'])) ?>[/code]
이렇게 해 보세요.
메너
2년 전
너무 완벽합니다. 구글링 해 보니
<?php echo mb_substr($list[$i]['wr_10'],0,10); ?> 이런 것도 있길래 적용해 보니 동일한 데이터가 출력 됩니다.

오늘 너무 감사했습니다.
들레아빠
2년 전
네 수고 하셨습니다.

mb_substr 은 글자를 자르는 함수 입니다. 날짜포맷 함수를 사용 하세요.

댓글을 작성하려면 로그인이 필요합니다.

답변을 작성하려면 로그인이 필요합니다.

로그인