본문
이번달 달력(양력)을 표시하는 소스입니다. 조금만 응용하면 여러가지 모양이 나올 수 있겠죠!
<?php
// 지정한 년,월의 총 일수를 구한다.
function cal_days_in_month($month, $year) {
return $month == 2 ? ($year % 4 ? 28 : ($year % 100 ? 29 : ($year % 400 ? 28 : 29))) : (($month - 1) % 7 % 2 ? 30 : 31);
}
?>
<?php
$date_month = date("m"); //오늘이 속한 월(1,2,3...12)
$date_year = date("Y"); //오늘이 속한 년(...2003,2004,2005...)
$t_days = cal_days_in_month($date_month, $date_year); //지정한 년,월의 총 일수(28,29,30,31)
$day = date("w", mktime(0, 0, 0, $date_month, 1, $date_year)); //0(일요일)부터 6(토요일)
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=euc-kr">
<title>달력</title>
<style type=text/css>
td { font-size:12px; font-family:돋움체; color:#7D7D7D; line-height:1.2; }
th { font-size:13px; font-family:돋움체; color:#000000; line-height:1.5; }
.today { font-size:12px; font-family:돋움체; color:#000000; background:#C4E1FF line-height:1.2; }
</style>
</head>
<body bgcolor=#FFFFFF>
<table border="0" bgcolor="#F2F2F2" cellpadding="2" cellspacing="2">
<tr><th colspan="7"><?php echo $date_year."년 ".$date_month."월"; ?></th></tr>
<tr bgcolor="#C0C0C0"><th><font color="#FF0000">일</font></th><th>월</th><th>화</th><th>수</th>
<th>목</th><th>금</th><th><font color="#0000FF">토</font></th></tr>
<?php
for ($i = 0; $i <= $t_days; $i++) {
if ($day > 6) {
echo "</tr>\n<tr>\n";
$day = 0;
}
if ($i == date("j")) { ?>
<td align="right" class="today"><?php echo $i; $day++; echo "</td>\n";
}
else if ($i > 0) { ?>
<td align="right"><?php echo $i; $day++; echo "</td>\n";
}
else if ($day > 0) { ?>
<tr><td colspan="<?php echo $day; ?>"><?php echo "</td>\n";
}
if ($i == $t_days && $day < 6) { ?>
<td colspan="<?php echo 7 - $day; ?>"><?php echo "</td>\n</tr>\n";
}
}
?>
</table>
</body>
</html><
<?php
// 지정한 년,월의 총 일수를 구한다.
function cal_days_in_month($month, $year) {
return $month == 2 ? ($year % 4 ? 28 : ($year % 100 ? 29 : ($year % 400 ? 28 : 29))) : (($month - 1) % 7 % 2 ? 30 : 31);
}
?>
<?php
$date_month = date("m"); //오늘이 속한 월(1,2,3...12)
$date_year = date("Y"); //오늘이 속한 년(...2003,2004,2005...)
$t_days = cal_days_in_month($date_month, $date_year); //지정한 년,월의 총 일수(28,29,30,31)
$day = date("w", mktime(0, 0, 0, $date_month, 1, $date_year)); //0(일요일)부터 6(토요일)
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=euc-kr">
<title>달력</title>
<style type=text/css>
td { font-size:12px; font-family:돋움체; color:#7D7D7D; line-height:1.2; }
th { font-size:13px; font-family:돋움체; color:#000000; line-height:1.5; }
.today { font-size:12px; font-family:돋움체; color:#000000; background:#C4E1FF line-height:1.2; }
</style>
</head>
<body bgcolor=#FFFFFF>
<table border="0" bgcolor="#F2F2F2" cellpadding="2" cellspacing="2">
<tr><th colspan="7"><?php echo $date_year."년 ".$date_month."월"; ?></th></tr>
<tr bgcolor="#C0C0C0"><th><font color="#FF0000">일</font></th><th>월</th><th>화</th><th>수</th>
<th>목</th><th>금</th><th><font color="#0000FF">토</font></th></tr>
<?php
for ($i = 0; $i <= $t_days; $i++) {
if ($day > 6) {
echo "</tr>\n<tr>\n";
$day = 0;
}
if ($i == date("j")) { ?>
<td align="right" class="today"><?php echo $i; $day++; echo "</td>\n";
}
else if ($i > 0) { ?>
<td align="right"><?php echo $i; $day++; echo "</td>\n";
}
else if ($day > 0) { ?>
<tr><td colspan="<?php echo $day; ?>"><?php echo "</td>\n";
}
if ($i == $t_days && $day < 6) { ?>
<td colspan="<?php echo 7 - $day; ?>"><?php echo "</td>\n</tr>\n";
}
}
?>
</table>
</body>
</html><
첨부파일
달력.txt (1.9 KB, 28회)댓글 4개
천재조상훈
12년 전
감사요
12년 전
감사
12년 전
감사
12년 전
감사합니다.
게시판 목록
프로그램
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 6730 |
|
11년 전 | 1108 | |
| 6729 | 11년 전 | 564 | ||
| 6728 |
|
11년 전 | 579 | |
| 6727 | 11년 전 | 2424 | ||
| 6726 | 11년 전 | 598 | ||
| 6725 |
네모웹에이전시
|
11년 전 | 438 | |
| 6724 |
네모웹에이전시
|
11년 전 | 884 | |
| 6723 | 11년 전 | 1020 | ||
| 6722 | 11년 전 | 961 | ||
| 6721 | 11년 전 | 647 | ||
| 6720 | 11년 전 | 1977 | ||
| 6719 | 11년 전 | 2199 | ||
| 6718 | 11년 전 | 1101 | ||
| 6717 |
|
11년 전 | 656 | |
| 6716 | 11년 전 | 2311 | ||
| 6715 | 11년 전 | 7580 | ||
| 6714 | 11년 전 | 2047 | ||
| 6713 | 11년 전 | 781 | ||
| 6712 |
geektoo
|
11년 전 | 1157 | |
| 6711 | 11년 전 | 897 | ||
| 6710 |
sirzzang
|
11년 전 | 2130 | |
| 6709 |
bewitched
|
11년 전 | 1801 | |
| 6708 |
levin
|
11년 전 | 569 | |
| 6707 | 11년 전 | 768 | ||
| 6706 | 11년 전 | 1793 | ||
| 6705 | 11년 전 | 991 | ||
| 6704 |
|
11년 전 | 753 | |
| 6703 | 11년 전 | 416 | ||
| 6702 | 11년 전 | 1100 | ||
| 6701 | 11년 전 | 804 | ||
| 6700 | 11년 전 | 1721 | ||
| 6699 | 11년 전 | 716 | ||
| 6698 |
이박사친구
|
11년 전 | 730 | |
| 6697 | 11년 전 | 1218 | ||
| 6696 | 11년 전 | 620 | ||
| 6695 |
Header
|
11년 전 | 706 | |
| 6694 | 11년 전 | 1163 | ||
| 6693 |
|
11년 전 | 1113 | |
| 6692 | 11년 전 | 1150 | ||
| 6691 | 11년 전 | 1288 | ||
| 6690 |
|
11년 전 | 715 | |
| 6689 | 11년 전 | 896 | ||
| 6688 | 11년 전 | 935 | ||
| 6687 | 11년 전 | 535 | ||
| 6686 |
RGB255
|
11년 전 | 964 | |
| 6685 |
|
11년 전 | 640 | |
| 6684 | 11년 전 | 718 | ||
| 6683 | 11년 전 | 386 | ||
| 6682 | 11년 전 | 1129 | ||
| 6681 | 11년 전 | 1419 | ||
| 6680 | 11년 전 | 451 | ||
| 6679 |
RGB255
|
11년 전 | 396 | |
| 6678 | 11년 전 | 1350 | ||
| 6677 |
|
11년 전 | 440 | |
| 6676 | 11년 전 | 1015 | ||
| 6675 |
디자이너필이
|
11년 전 | 826 | |
| 6674 | 11년 전 | 1242 | ||
| 6673 | 11년 전 | 1314 | ||
| 6672 | 11년 전 | 6029 | ||
| 6671 | 11년 전 | 1339 | ||
| 6670 |
하프의정령
|
11년 전 | 570 | |
| 6669 | 11년 전 | 413 | ||
| 6668 |
공부하고가겠슴다
|
11년 전 | 448 | |
| 6667 |
하프의정령
|
11년 전 | 548 | |
| 6666 | 11년 전 | 787 | ||
| 6665 | 11년 전 | 1412 | ||
| 6664 | 11년 전 | 929 | ||
| 6663 | 11년 전 | 1153 | ||
| 6662 | 11년 전 | 411 | ||
| 6661 |
basketball
|
11년 전 | 507 | |
| 6660 | 11년 전 | 2508 | ||
| 6659 | 12년 전 | 1611 | ||
| 6658 |
|
12년 전 | 1333 | |
| 6657 |
|
12년 전 | 3158 | |
| 6656 | 12년 전 | 566 | ||
| 6655 |
프로프리랜서
|
12년 전 | 2333 | |
| 6654 |
프로프리랜서
|
12년 전 | 1911 | |
| 6653 |
프로프리랜서
|
12년 전 | 1745 | |
| 6652 |
프로프리랜서
|
12년 전 | 1830 | |
| 6651 |
|
12년 전 | 783 | |
| 6650 | 12년 전 | 1317 | ||
| 6649 | 12년 전 | 1318 | ||
| 6648 | 12년 전 | 811 | ||
| 6647 | 12년 전 | 3161 | ||
| 6646 | 12년 전 | 469 | ||
| 6645 | 12년 전 | 966 | ||
| 6644 |
BBAYOUNG
|
12년 전 | 1378 | |
| 6643 | 12년 전 | 1793 | ||
| 6642 | 12년 전 | 643 | ||
| 6641 | 12년 전 | 1333 | ||
| 6640 | 12년 전 | 706 | ||
| 6639 | 12년 전 | 2320 | ||
| 6638 |
jasmin2
|
12년 전 | 752 | |
| 6637 |
geektoo
|
12년 전 | 444 | |
| 6636 | 12년 전 | 667 | ||
| 6635 |
프로프리랜서
|
12년 전 | 2235 | |
| 6634 |
프로프리랜서
|
12년 전 | 1740 | |
| 6633 |
프로프리랜서
|
12년 전 | 4060 | |
| 6632 |
프로프리랜서
|
12년 전 | 1347 | |
| 6631 |
프로프리랜서
|
12년 전 | 1782 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기