그동안 일하면서 어떻게 달력이 필요 한 작업이 하나도 없었을까요??? 아이러니 하네요 ㅎㅎㅎ
방금 하나 만들어 봤는데 유효한지 모르겠네요~
[code]
/*
* "년, 월, 일"의 초기 값을 설정한다.(전달값이 있을경우 전달값 출력)
*/
$Year = ($_REQUEST['year'])?$_REQUEST['year']:date('Y');
$Month = ($_REQUEST['month'])?str_pad($_REQUEST['month'], 2, 0, STR_PAD_LEFT):date('m');
$Day = ($REQUEST['day'])?str_pad($_REQUEST['day'], 2, 0, STR_PAD_LEFT):date('d');
/*
* 초기 조건값
*/
$FirstDayWeek = date('w', strtotime($Year.$Month.'01')); // 1일은 몇 요일?
$LastDay = date('t', strtotime($Year.$Month.'01')); // 몇일까지 있니?
$PreLastDay = date('t', strtotime("-1 month", strtotime($Year.$Month.'01'))); // 지난달은 몇일 까지 있니?
$Day = $PreLastDay - $FirstDayWeek;
$HiddenDate = true;
?>
<div class="reservation">
<table class="calendar">
<thead>
<tr class="week">
<th scope="col">일요일</th>
<th scope="col">월요일</th>
<th scope="col">화요일</th>
<th scope="col">수요일</th>
<th scope="col">목요일</th>
<th scope="col">금요일</th>
<th scope="col">토요일</th>
</tr>
</thead>
<tbody class="mon">
<?php for($m=1; $m<7; $m++) { ?>
<tr>
<?php
for($w=0; $w<7; $w++) {
if($Day >= $PreLastDay) {
$HiddenDate = false;
$Day = 0;
$PreLastDay = $LastDay;
$FullDate = '';
}
$Day++; // day 증가
$FullDate = $Year.'-'.str_pad($Month, 2, 0, STR_PAD_LEFT).'-'.str_pad($Day, 2, 0, STR_PAD_LEFT);
if($HiddenDate || date('w', strtotime($FullDate)) <> $w) {
$FullDate = '';
$HiddenDate = true;
}
?>
<td>
<div><strong>날짜:</strong> <?php echo $Day; ?></div>
<div><strong>년.월.일:</strong> <?php echo ($FullDate)?$FullDate:'해당없음'; ?></div>
<div><strong>당월에 포함된 날짜인지 판단:</strong> <?php echo ($HiddenDate)?'미포함':'포함'; ?></div>
</td>
<?php } ?>
</tr>
<?php } ?>
</tbody>
</table>
</div>
[/code]
댓글 2개
bamchi
11년 전
고생하셨습니다. ㅎㅎ
Terrorboy
11년 전
실제 사용 해본결과 문제가 없네요 ^^
[http://sir.co.kr/data/cheditor4/1407/b78d5034adcef6e421f2c138865330d6_1404884563_4885.png]
[http://sir.co.kr/data/cheditor4/1407/b78d5034adcef6e421f2c138865330d6_1404884563_4885.png]
게시판 목록
프로그램
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 7830 | 10년 전 | 454 | ||
| 7829 |
|
10년 전 | 641 | |
| 7828 | 10년 전 | 563 | ||
| 7827 | 10년 전 | 459 | ||
| 7826 | 10년 전 | 473 | ||
| 7825 | 10년 전 | 516 | ||
| 7824 | 10년 전 | 478 | ||
| 7823 | 10년 전 | 422 | ||
| 7822 | 10년 전 | 395 | ||
| 7821 | 10년 전 | 339 | ||
| 7820 | 10년 전 | 363 | ||
| 7819 |
|
10년 전 | 765 | |
| 7818 | 10년 전 | 418 | ||
| 7817 | 10년 전 | 580 | ||
| 7816 | 10년 전 | 438 | ||
| 7815 | 10년 전 | 631 | ||
| 7814 | 10년 전 | 471 | ||
| 7813 | 10년 전 | 427 | ||
| 7812 | 10년 전 | 437 | ||
| 7811 | 10년 전 | 416 | ||
| 7810 | 10년 전 | 613 | ||
| 7809 | 10년 전 | 544 | ||
| 7808 | 10년 전 | 421 | ||
| 7807 | 10년 전 | 437 | ||
| 7806 |
프로그래머7
|
10년 전 | 1362 | |
| 7805 | 10년 전 | 1301 | ||
| 7804 |
zahir1312
|
10년 전 | 802 | |
| 7803 |
|
10년 전 | 1401 | |
| 7802 | 10년 전 | 499 | ||
| 7801 | 10년 전 | 882 | ||
| 7800 | 10년 전 | 1109 | ||
| 7799 | 10년 전 | 587 | ||
| 7798 | 10년 전 | 538 | ||
| 7797 | 10년 전 | 557 | ||
| 7796 | 10년 전 | 389 | ||
| 7795 | 10년 전 | 541 | ||
| 7794 | 10년 전 | 585 | ||
| 7793 | 10년 전 | 1084 | ||
| 7792 | 10년 전 | 509 | ||
| 7791 | 10년 전 | 594 | ||
| 7790 | 10년 전 | 528 | ||
| 7789 |
fbastore
|
10년 전 | 1480 | |
| 7788 | 10년 전 | 582 | ||
| 7787 | 10년 전 | 437 | ||
| 7786 | 10년 전 | 647 | ||
| 7785 | 10년 전 | 620 | ||
| 7784 | 10년 전 | 680 | ||
| 7783 | 10년 전 | 499 | ||
| 7782 | 10년 전 | 525 | ||
| 7781 | 10년 전 | 933 | ||
| 7780 | 10년 전 | 845 | ||
| 7779 | 10년 전 | 798 | ||
| 7778 | 10년 전 | 383 | ||
| 7777 | 10년 전 | 496 | ||
| 7776 | 10년 전 | 491 | ||
| 7775 | 10년 전 | 430 | ||
| 7774 | 10년 전 | 645 | ||
| 7773 | 10년 전 | 400 | ||
| 7772 | 10년 전 | 771 | ||
| 7771 | 10년 전 | 425 | ||
| 7770 | 10년 전 | 670 | ||
| 7769 | 10년 전 | 427 | ||
| 7768 | 10년 전 | 649 | ||
| 7767 | 10년 전 | 1204 | ||
| 7766 | 10년 전 | 529 | ||
| 7765 | 10년 전 | 585 | ||
| 7764 |
잘살아보자
|
10년 전 | 433 | |
| 7763 |
|
10년 전 | 1492 | |
| 7762 |
Tosea
|
10년 전 | 1087 | |
| 7761 | 10년 전 | 686 | ||
| 7760 |
잘살아보자
|
10년 전 | 736 | |
| 7759 |
잘살아보자
|
10년 전 | 574 | |
| 7758 |
잘살아보자
|
10년 전 | 629 | |
| 7757 | 10년 전 | 1274 | ||
| 7756 |
ITBANK
|
10년 전 | 1284 | |
| 7755 | 10년 전 | 1942 | ||
| 7754 | 10년 전 | 1097 | ||
| 7753 | 10년 전 | 915 | ||
| 7752 | 10년 전 | 1417 | ||
| 7751 |
잘살아보자
|
10년 전 | 572 | |
| 7750 |
잘살아보자
|
10년 전 | 505 | |
| 7749 |
잘살아보자
|
10년 전 | 521 | |
| 7748 |
잘살아보자
|
10년 전 | 543 | |
| 7747 |
잘살아보자
|
10년 전 | 621 | |
| 7746 |
잘살아보자
|
10년 전 | 696 | |
| 7745 |
잘살아보자
|
10년 전 | 942 | |
| 7744 |
잘살아보자
|
10년 전 | 438 | |
| 7743 | 10년 전 | 966 | ||
| 7742 |
starbros
|
10년 전 | 861 | |
| 7741 |
잘살아보자
|
10년 전 | 700 | |
| 7740 |
잘살아보자
|
10년 전 | 589 | |
| 7739 |
잘살아보자
|
10년 전 | 485 | |
| 7738 |
잘살아보자
|
10년 전 | 561 | |
| 7737 |
잘살아보자
|
10년 전 | 540 | |
| 7736 |
잘살아보자
|
10년 전 | 560 | |
| 7735 |
잘살아보자
|
10년 전 | 892 | |
| 7734 |
잘살아보자
|
10년 전 | 452 | |
| 7733 |
잘살아보자
|
10년 전 | 563 | |
| 7732 |
잘살아보자
|
10년 전 | 727 | |
| 7731 |
잘살아보자
|
10년 전 | 651 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기