본문
이번달 달력(양력)을 표시하는 소스입니다. 조금만 응용하면 여러가지 모양이 나올 수 있겠죠!
<?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년 전
감사합니다.
게시판 목록
프로그램
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 6330 |
|
12년 전 | 1790 | |
| 6329 |
내가짱니네가짱
|
12년 전 | 1223 | |
| 6328 |
AMDbest
|
12년 전 | 487 | |
| 6327 | 12년 전 | 1689 | ||
| 6326 | 12년 전 | 1327 | ||
| 6325 | 12년 전 | 7606 | ||
| 6324 |
AMDbest
|
12년 전 | 2190 | |
| 6323 |
|
12년 전 | 1967 | |
| 6322 | 12년 전 | 2029 | ||
| 6321 | 12년 전 | 2466 | ||
| 6320 |
senseme
|
12년 전 | 562 | |
| 6319 | 12년 전 | 3705 | ||
| 6318 | 12년 전 | 1366 | ||
| 6317 |
kiplayer
|
12년 전 | 6404 | |
| 6316 | 12년 전 | 1007 | ||
| 6315 | 12년 전 | 962 | ||
| 6314 |
상엽나르도
|
12년 전 | 1278 | |
| 6313 |
검은고양이1983
|
12년 전 | 650 | |
| 6312 | 12년 전 | 3114 | ||
| 6311 | 12년 전 | 1412 | ||
| 6310 |
testers
|
12년 전 | 1479 | |
| 6309 | 12년 전 | 982 | ||
| 6308 | 12년 전 | 2598 | ||
| 6307 | 12년 전 | 1638 | ||
| 6306 | 12년 전 | 428 | ||
| 6305 | 12년 전 | 3495 | ||
| 6304 | 12년 전 | 992 | ||
| 6303 | 12년 전 | 821 | ||
| 6302 | 12년 전 | 1188 | ||
| 6301 | 12년 전 | 5560 | ||
| 6300 |
|
12년 전 | 1190 | |
| 6299 |
AMDbest
|
12년 전 | 2800 | |
| 6298 |
AMDbest
|
12년 전 | 2245 | |
| 6297 |
프리랜서개발자
|
12년 전 | 463 | |
| 6296 | 12년 전 | 2926 | ||
| 6295 |
SUPERMANs
|
12년 전 | 1373 | |
| 6294 | 12년 전 | 1289 | ||
| 6293 | 12년 전 | 1342 | ||
| 6292 |
오늘도망했다
|
12년 전 | 3264 | |
| 6291 |
senseme
|
12년 전 | 2024 | |
| 6290 |
senseme
|
12년 전 | 3683 | |
| 6289 |
senseme
|
12년 전 | 8572 | |
| 6288 |
senseme
|
12년 전 | 4166 | |
| 6287 |
senseme
|
12년 전 | 3729 | |
| 6286 |
senseme
|
12년 전 | 1349 | |
| 6285 |
senseme
|
12년 전 | 1426 | |
| 6284 |
프로프리랜서
|
12년 전 | 3145 | |
| 6283 |
프로프리랜서
|
12년 전 | 3980 | |
| 6282 |
프로프리랜서
|
12년 전 | 4385 | |
| 6281 |
프로프리랜서
|
12년 전 | 1599 | |
| 6280 | 12년 전 | 1284 | ||
| 6279 |
AMDbest
|
12년 전 | 872 | |
| 6278 | 12년 전 | 971 | ||
| 6277 |
senseme
|
12년 전 | 2712 | |
| 6276 |
senseme
|
12년 전 | 2726 | |
| 6275 |
senseme
|
12년 전 | 1248 | |
| 6274 |
|
12년 전 | 2787 | |
| 6273 | 12년 전 | 1267 | ||
| 6272 | 12년 전 | 8450 | ||
| 6271 |
senseme
|
12년 전 | 1503 | |
| 6270 |
senseme
|
12년 전 | 3761 | |
| 6269 |
senseme
|
12년 전 | 6377 | |
| 6268 |
senseme
|
12년 전 | 1553 | |
| 6267 | 12년 전 | 2823 | ||
| 6266 | 12년 전 | 574 | ||
| 6265 | 12년 전 | 1290 | ||
| 6264 | 12년 전 | 1147 | ||
| 6263 |
senseme
|
12년 전 | 1305 | |
| 6262 |
senseme
|
12년 전 | 3300 | |
| 6261 |
senseme
|
12년 전 | 1078 | |
| 6260 |
senseme
|
12년 전 | 1817 | |
| 6259 |
senseme
|
12년 전 | 1249 | |
| 6258 |
senseme
|
12년 전 | 913 | |
| 6257 | 12년 전 | 1404 | ||
| 6256 | 12년 전 | 2096 | ||
| 6255 |
senseme
|
12년 전 | 1377 | |
| 6254 |
senseme
|
12년 전 | 1260 | |
| 6253 |
senseme
|
12년 전 | 1782 | |
| 6252 |
kiplayer
|
12년 전 | 14766 | |
| 6251 | 12년 전 | 1058 | ||
| 6250 | 12년 전 | 861 | ||
| 6249 | 12년 전 | 2708 | ||
| 6248 |
senseme
|
12년 전 | 8947 | |
| 6247 | 12년 전 | 1273 | ||
| 6246 |
프로프리랜서
|
12년 전 | 1158 | |
| 6245 |
프로프리랜서
|
12년 전 | 1621 | |
| 6244 |
프로프리랜서
|
12년 전 | 1126 | |
| 6243 |
프로프리랜서
|
12년 전 | 1257 | |
| 6242 |
프로프리랜서
|
12년 전 | 3543 | |
| 6241 |
프로프리랜서
|
12년 전 | 1451 | |
| 6240 |
프로프리랜서
|
12년 전 | 2121 | |
| 6239 |
softhead
|
12년 전 | 1141 | |
| 6238 |
senseme
|
12년 전 | 1308 | |
| 6237 |
senseme
|
12년 전 | 3021 | |
| 6236 | 12년 전 | 866 | ||
| 6235 | 12년 전 | 1329 | ||
| 6234 | 12년 전 | 1599 | ||
| 6233 | 12년 전 | 2026 | ||
| 6232 | 12년 전 | 2134 | ||
| 6231 | 12년 전 | 2559 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기