그동안 일하면서 어떻게 달력이 필요 한 작업이 하나도 없었을까요??? 아이러니 하네요 ㅎㅎㅎ
방금 하나 만들어 봤는데 유효한지 모르겠네요~
[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]
게시판 목록
프로그램
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 430 | 19년 전 | 4128 | ||
| 429 | 19년 전 | 3323 | ||
| 428 | 19년 전 | 4143 | ||
| 427 | 19년 전 | 3491 | ||
| 426 | 19년 전 | 3118 | ||
| 425 | 19년 전 | 3430 | ||
| 424 | 19년 전 | 2451 | ||
| 423 | 19년 전 | 2880 | ||
| 422 | 19년 전 | 2370 | ||
| 421 | 19년 전 | 3723 | ||
| 420 | 19년 전 | 4755 | ||
| 419 | 19년 전 | 3831 | ||
| 418 |
|
19년 전 | 1765 | |
| 417 | 19년 전 | 2764 | ||
| 416 | 19년 전 | 2408 | ||
| 415 | 19년 전 | 2613 | ||
| 414 | 19년 전 | 4430 | ||
| 413 |
|
19년 전 | 2623 | |
| 412 | 19년 전 | 3065 | ||
| 411 |
|
19년 전 | 3002 | |
| 410 |
|
19년 전 | 3707 | |
| 409 |
|
19년 전 | 3651 | |
| 408 |
|
19년 전 | 1871 | |
| 407 | 19년 전 | 2242 | ||
| 406 | 19년 전 | 2810 | ||
| 405 | 19년 전 | 2475 | ||
| 404 | 19년 전 | 4323 | ||
| 403 | 19년 전 | 3315 | ||
| 402 |
NeoGenesis
|
19년 전 | 4111 | |
| 401 | 19년 전 | 2619 | ||
| 400 |
|
19년 전 | 2526 | |
| 399 | 19년 전 | 2976 | ||
| 398 | 19년 전 | 2510 | ||
| 397 | 19년 전 | 2802 | ||
| 396 | 19년 전 | 2509 | ||
| 395 | 19년 전 | 3216 | ||
| 394 | 19년 전 | 1760 | ||
| 393 | 19년 전 | 3011 | ||
| 392 | 19년 전 | 2287 | ||
| 391 | 19년 전 | 2191 | ||
| 390 | 19년 전 | 2301 | ||
| 389 | 19년 전 | 2661 | ||
| 388 | 19년 전 | 2210 | ||
| 387 | 19년 전 | 4494 | ||
| 386 |
|
19년 전 | 2702 | |
| 385 |
|
19년 전 | 2509 | |
| 384 | 19년 전 | 3051 | ||
| 383 | 19년 전 | 3077 | ||
| 382 | 19년 전 | 3123 | ||
| 381 |
|
19년 전 | 2650 | |
| 380 |
|
19년 전 | 3034 | |
| 379 | 19년 전 | 2558 | ||
| 378 | 19년 전 | 2230 | ||
| 377 | 19년 전 | 2793 | ||
| 376 | 19년 전 | 2479 | ||
| 375 |
|
19년 전 | 2576 | |
| 374 | 19년 전 | 3835 | ||
| 373 | 19년 전 | 3288 | ||
| 372 | 19년 전 | 5011 | ||
| 371 |
세은아빠2
|
19년 전 | 2432 | |
| 370 | 19년 전 | 4512 | ||
| 369 | 19년 전 | 3121 | ||
| 368 | 19년 전 | 2920 | ||
| 367 | 19년 전 | 3746 | ||
| 366 | 19년 전 | 2671 | ||
| 365 | 19년 전 | 3757 | ||
| 364 | 19년 전 | 4033 | ||
| 363 | 19년 전 | 3467 | ||
| 362 | 19년 전 | 3501 | ||
| 361 | 20년 전 | 4124 | ||
| 360 |
hwatta
|
20년 전 | 2381 | |
| 359 | 20년 전 | 5124 | ||
| 358 | 20년 전 | 3675 | ||
| 357 | 20년 전 | 2620 | ||
| 356 |
sdesign1s
|
20년 전 | 2299 | |
| 355 | 20년 전 | 2778 | ||
| 354 | 20년 전 | 3041 | ||
| 353 | 20년 전 | 2808 | ||
| 352 |
|
20년 전 | 5788 | |
| 351 |
|
20년 전 | 2725 | |
| 350 |
|
20년 전 | 4314 | |
| 349 |
hwatta
|
20년 전 | 2205 | |
| 348 | 20년 전 | 7319 | ||
| 347 | 20년 전 | 2426 | ||
| 346 | 20년 전 | 3523 | ||
| 345 | 20년 전 | 4326 | ||
| 344 | 20년 전 | 2673 | ||
| 343 | 20년 전 | 3936 | ||
| 342 | 20년 전 | 3081 | ||
| 341 | 20년 전 | 4112 | ||
| 340 |
|
20년 전 | 5168 | |
| 339 |
|
20년 전 | 4253 | |
| 338 | 20년 전 | 5898 | ||
| 337 | 20년 전 | 2058 | ||
| 336 |
|
20년 전 | 3351 | |
| 335 |
|
20년 전 | 3568 | |
| 334 |
|
20년 전 | 2963 | |
| 333 |
hwatta
|
20년 전 | 2467 | |
| 332 | 20년 전 | 4671 | ||
| 331 | 20년 전 | 2293 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기