본문
이번달 달력(양력)을 표시하는 소스입니다. 조금만 응용하면 여러가지 모양이 나올 수 있겠죠!
<?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년 전
감사합니다.
게시판 목록
프로그램
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 6630 |
차가운바람
|
12년 전 | 1172 | |
| 6629 | 12년 전 | 1169 | ||
| 6628 |
put777
|
12년 전 | 651 | |
| 6627 |
|
12년 전 | 705 | |
| 6626 | 12년 전 | 1621 | ||
| 6625 |
|
12년 전 | 728 | |
| 6624 |
미켈란젤로의왼손
|
12년 전 | 493 | |
| 6623 |
|
12년 전 | 1054 | |
| 6622 | 12년 전 | 1404 | ||
| 6621 |
차가운바람
|
12년 전 | 643 | |
| 6620 | 12년 전 | 745 | ||
| 6619 |
|
12년 전 | 981 | |
| 6618 | 12년 전 | 1752 | ||
| 6617 | 12년 전 | 646 | ||
| 6616 |
차가운바람
|
12년 전 | 905 | |
| 6615 | 12년 전 | 2861 | ||
| 6614 | 12년 전 | 623 | ||
| 6613 |
강명구베드로
|
12년 전 | 535 | |
| 6612 |
|
12년 전 | 434 | |
| 6611 | 12년 전 | 1215 | ||
| 6610 | 12년 전 | 1036 | ||
| 6609 | 12년 전 | 3686 | ||
| 6608 |
|
12년 전 | 835 | |
| 6607 | 12년 전 | 702 | ||
| 6606 | 12년 전 | 569 | ||
| 6605 | 12년 전 | 462 | ||
| 6604 | 12년 전 | 980 | ||
| 6603 |
geektoo
|
12년 전 | 712 | |
| 6602 | 12년 전 | 850 | ||
| 6601 | 12년 전 | 374 | ||
| 6600 | 12년 전 | 422 | ||
| 6599 | 12년 전 | 574 | ||
| 6598 | 12년 전 | 956 | ||
| 6597 | 12년 전 | 952 | ||
| 6596 | 12년 전 | 439 | ||
| 6595 | 12년 전 | 797 | ||
| 6594 | 12년 전 | 4579 | ||
| 6593 | 12년 전 | 2583 | ||
| 6592 | 12년 전 | 835 | ||
| 6591 | 12년 전 | 598 | ||
| 6590 |
|
12년 전 | 1409 | |
| 6589 | 12년 전 | 780 | ||
| 6588 |
GINUSSOFT
|
12년 전 | 5135 | |
| 6587 | 12년 전 | 6222 | ||
| 6586 | 12년 전 | 1055 | ||
| 6585 | 12년 전 | 815 | ||
| 6584 | 12년 전 | 475 | ||
| 6583 |
|
12년 전 | 990 | |
| 6582 | 12년 전 | 883 | ||
| 6581 | 12년 전 | 857 | ||
| 6580 | 12년 전 | 626 | ||
| 6579 |
알랑가몰라
|
12년 전 | 942 | |
| 6578 | 12년 전 | 1339 | ||
| 6577 | 12년 전 | 1514 | ||
| 6576 |
경dragon
|
12년 전 | 783 | |
| 6575 | 12년 전 | 1897 | ||
| 6574 | 12년 전 | 695 | ||
| 6573 | 12년 전 | 1000 | ||
| 6572 |
|
12년 전 | 1680 | |
| 6571 |
CTOMAN
|
12년 전 | 1975 | |
| 6570 | 12년 전 | 1743 | ||
| 6569 | 12년 전 | 1902 | ||
| 6568 | 12년 전 | 2413 | ||
| 6567 | 12년 전 | 1037 | ||
| 6566 |
lainfox
|
12년 전 | 1541 | |
| 6565 | 12년 전 | 3666 | ||
| 6564 |
제주프라이스
|
12년 전 | 1544 | |
| 6563 | 12년 전 | 1580 | ||
| 6562 |
프로프리랜서
|
12년 전 | 1361 | |
| 6561 |
프로프리랜서
|
12년 전 | 981 | |
| 6560 |
프로프리랜서
|
12년 전 | 1239 | |
| 6559 |
프로프리랜서
|
12년 전 | 1149 | |
| 6558 |
프로프리랜서
|
12년 전 | 1365 | |
| 6557 |
프로프리랜서
|
12년 전 | 1989 | |
| 6556 |
프로프리랜서
|
12년 전 | 1533 | |
| 6555 |
프로프리랜서
|
12년 전 | 1375 | |
| 6554 |
프로프리랜서
|
12년 전 | 3899 | |
| 6553 |
프로프리랜서
|
12년 전 | 1522 | |
| 6552 | 12년 전 | 858 | ||
| 6551 |
왕초보sasa
|
12년 전 | 1552 | |
| 6550 |
왕초보sasa
|
12년 전 | 646 | |
| 6549 |
왕초보sasa
|
12년 전 | 919 | |
| 6548 | 12년 전 | 1309 | ||
| 6547 | 12년 전 | 1205 | ||
| 6546 | 12년 전 | 5172 | ||
| 6545 | 12년 전 | 2528 | ||
| 6544 |
AnnieK
|
12년 전 | 1792 | |
| 6543 |
베르무트7
|
12년 전 | 658 | |
| 6542 |
오늘도망했다
|
12년 전 | 2243 | |
| 6541 | 12년 전 | 825 | ||
| 6540 | 12년 전 | 1147 | ||
| 6539 | 12년 전 | 857 | ||
| 6538 |
senseme
|
12년 전 | 3384 | |
| 6537 | 12년 전 | 786 | ||
| 6536 | 12년 전 | 3674 | ||
| 6535 | 12년 전 | 1360 | ||
| 6534 | 12년 전 | 1631 | ||
| 6533 | 12년 전 | 2255 | ||
| 6532 |
냐옹이사범
|
12년 전 | 2314 | |
| 6531 | 12년 전 | 576 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기