그동안 일하면서 어떻게 달력이 필요 한 작업이 하나도 없었을까요??? 아이러니 하네요 ㅎㅎㅎ
방금 하나 만들어 봤는데 유효한지 모르겠네요~
[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]
게시판 목록
프로그램
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 6730 |
|
11년 전 | 1107 | |
| 6729 | 11년 전 | 563 | ||
| 6728 |
|
11년 전 | 576 | |
| 6727 | 11년 전 | 2424 | ||
| 6726 | 11년 전 | 597 | ||
| 6725 |
네모웹에이전시
|
11년 전 | 437 | |
| 6724 |
네모웹에이전시
|
11년 전 | 884 | |
| 6723 | 11년 전 | 1018 | ||
| 6722 | 11년 전 | 961 | ||
| 6721 | 11년 전 | 646 | ||
| 6720 | 11년 전 | 1974 | ||
| 6719 | 11년 전 | 2197 | ||
| 6718 | 11년 전 | 1098 | ||
| 6717 |
|
11년 전 | 654 | |
| 6716 | 11년 전 | 2311 | ||
| 6715 | 11년 전 | 7579 | ||
| 6714 | 11년 전 | 2046 | ||
| 6713 | 11년 전 | 776 | ||
| 6712 |
geektoo
|
11년 전 | 1156 | |
| 6711 | 11년 전 | 896 | ||
| 6710 |
sirzzang
|
11년 전 | 2128 | |
| 6709 |
bewitched
|
11년 전 | 1801 | |
| 6708 |
levin
|
11년 전 | 565 | |
| 6707 | 11년 전 | 768 | ||
| 6706 | 11년 전 | 1789 | ||
| 6705 | 11년 전 | 988 | ||
| 6704 |
|
11년 전 | 752 | |
| 6703 | 11년 전 | 415 | ||
| 6702 | 11년 전 | 1096 | ||
| 6701 | 11년 전 | 804 | ||
| 6700 | 11년 전 | 1720 | ||
| 6699 | 11년 전 | 716 | ||
| 6698 |
이박사친구
|
11년 전 | 728 | |
| 6697 | 11년 전 | 1218 | ||
| 6696 | 11년 전 | 618 | ||
| 6695 |
Header
|
11년 전 | 706 | |
| 6694 | 11년 전 | 1161 | ||
| 6693 |
|
11년 전 | 1106 | |
| 6692 | 11년 전 | 1148 | ||
| 6691 | 11년 전 | 1288 | ||
| 6690 |
|
11년 전 | 715 | |
| 6689 | 11년 전 | 895 | ||
| 6688 | 11년 전 | 931 | ||
| 6687 | 11년 전 | 531 | ||
| 6686 |
RGB255
|
11년 전 | 962 | |
| 6685 |
|
11년 전 | 640 | |
| 6684 | 11년 전 | 716 | ||
| 6683 | 11년 전 | 386 | ||
| 6682 | 11년 전 | 1126 | ||
| 6681 | 11년 전 | 1416 | ||
| 6680 | 11년 전 | 439 | ||
| 6679 |
RGB255
|
11년 전 | 390 | |
| 6678 | 11년 전 | 1348 | ||
| 6677 |
|
11년 전 | 436 | |
| 6676 | 11년 전 | 1012 | ||
| 6675 |
디자이너필이
|
11년 전 | 823 | |
| 6674 | 11년 전 | 1242 | ||
| 6673 | 11년 전 | 1314 | ||
| 6672 | 11년 전 | 6028 | ||
| 6671 | 11년 전 | 1337 | ||
| 6670 |
하프의정령
|
11년 전 | 568 | |
| 6669 | 11년 전 | 412 | ||
| 6668 |
공부하고가겠슴다
|
11년 전 | 446 | |
| 6667 |
하프의정령
|
11년 전 | 547 | |
| 6666 | 11년 전 | 787 | ||
| 6665 | 11년 전 | 1410 | ||
| 6664 | 11년 전 | 925 | ||
| 6663 | 11년 전 | 1149 | ||
| 6662 | 11년 전 | 410 | ||
| 6661 |
basketball
|
11년 전 | 506 | |
| 6660 | 11년 전 | 2506 | ||
| 6659 | 11년 전 | 1608 | ||
| 6658 |
|
11년 전 | 1325 | |
| 6657 |
|
11년 전 | 3154 | |
| 6656 | 12년 전 | 564 | ||
| 6655 |
프로프리랜서
|
12년 전 | 2332 | |
| 6654 |
프로프리랜서
|
12년 전 | 1906 | |
| 6653 |
프로프리랜서
|
12년 전 | 1745 | |
| 6652 |
프로프리랜서
|
12년 전 | 1830 | |
| 6651 |
|
12년 전 | 782 | |
| 6650 | 12년 전 | 1314 | ||
| 6649 | 12년 전 | 1315 | ||
| 6648 | 12년 전 | 809 | ||
| 6647 | 12년 전 | 3159 | ||
| 6646 | 12년 전 | 467 | ||
| 6645 | 12년 전 | 964 | ||
| 6644 |
BBAYOUNG
|
12년 전 | 1374 | |
| 6643 | 12년 전 | 1788 | ||
| 6642 | 12년 전 | 640 | ||
| 6641 | 12년 전 | 1333 | ||
| 6640 | 12년 전 | 705 | ||
| 6639 | 12년 전 | 2319 | ||
| 6638 |
jasmin2
|
12년 전 | 747 | |
| 6637 |
geektoo
|
12년 전 | 441 | |
| 6636 | 12년 전 | 663 | ||
| 6635 |
프로프리랜서
|
12년 전 | 2227 | |
| 6634 |
프로프리랜서
|
12년 전 | 1738 | |
| 6633 |
프로프리랜서
|
12년 전 | 4059 | |
| 6632 |
프로프리랜서
|
12년 전 | 1347 | |
| 6631 |
프로프리랜서
|
12년 전 | 1781 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기