본문
이번달 달력(양력)을 표시하는 소스입니다. 조금만 응용하면 여러가지 모양이 나올 수 있겠죠!
<?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년 전
감사합니다.
게시판 목록
프로그램
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 6930 |
SOFTA
|
11년 전 | 5984 | |
| 6929 |
|
11년 전 | 1596 | |
| 6928 | 11년 전 | 1756 | ||
| 6927 | 11년 전 | 1779 | ||
| 6926 | 11년 전 | 1884 | ||
| 6925 | 11년 전 | 2276 | ||
| 6924 | 11년 전 | 3874 | ||
| 6923 | 11년 전 | 2273 | ||
| 6922 |
level999
|
11년 전 | 1041 | |
| 6921 | 11년 전 | 822 | ||
| 6920 | 11년 전 | 956 | ||
| 6919 | 11년 전 | 1072 | ||
| 6918 | 11년 전 | 1311 | ||
| 6917 | 11년 전 | 15428 | ||
| 6916 | 11년 전 | 1426 | ||
| 6915 | 11년 전 | 588 | ||
| 6914 | 11년 전 | 616 | ||
| 6913 | 11년 전 | 880 | ||
| 6912 | 11년 전 | 3126 | ||
| 6911 |
사랑해요79
|
11년 전 | 967 | |
| 6910 | 11년 전 | 745 | ||
| 6909 | 11년 전 | 781 | ||
| 6908 | 11년 전 | 644 | ||
| 6907 | 11년 전 | 832 | ||
| 6906 | 11년 전 | 1588 | ||
| 6905 | 11년 전 | 569 | ||
| 6904 | 11년 전 | 1010 | ||
| 6903 | 11년 전 | 1676 | ||
| 6902 |
2donggalbi
|
11년 전 | 516 | |
| 6901 | 11년 전 | 1395 | ||
| 6900 | 11년 전 | 723 | ||
| 6899 | 11년 전 | 861 | ||
| 6898 |
열라뽕똬이
|
11년 전 | 1317 | |
| 6897 |
this1mg
|
11년 전 | 1614 | |
| 6896 |
sbdossb
|
11년 전 | 580 | |
| 6895 |
봉보로봉봉
|
11년 전 | 1154 | |
| 6894 |
똘똘이스머츠
|
11년 전 | 497 | |
| 6893 |
네이비컬러
|
11년 전 | 3639 | |
| 6892 | 11년 전 | 1077 | ||
| 6891 |
네이비컬러
|
11년 전 | 1319 | |
| 6890 | 11년 전 | 1141 | ||
| 6889 | 11년 전 | 589 | ||
| 6888 | 11년 전 | 726 | ||
| 6887 | 11년 전 | 615 | ||
| 6886 | 11년 전 | 5059 | ||
| 6885 | 11년 전 | 557 | ||
| 6884 |
asfasdfd235
|
11년 전 | 586 | |
| 6883 | 11년 전 | 3040 | ||
| 6882 | 11년 전 | 943 | ||
| 6881 | 11년 전 | 4430 | ||
| 6880 | 11년 전 | 1818 | ||
| 6879 |
퍼블리셔지노군
|
11년 전 | 2630 | |
| 6878 | 11년 전 | 559 | ||
| 6877 | 11년 전 | 583 | ||
| 6876 | 11년 전 | 1445 | ||
| 6875 | 11년 전 | 630 | ||
| 6874 | 11년 전 | 1603 | ||
| 6873 | 11년 전 | 1606 | ||
| 6872 | 11년 전 | 4461 | ||
| 6871 |
Abilityarch
|
11년 전 | 966 | |
| 6870 | 11년 전 | 2128 | ||
| 6869 | 11년 전 | 1410 | ||
| 6868 | 11년 전 | 1454 | ||
| 6867 | 11년 전 | 1527 | ||
| 6866 | 11년 전 | 744 | ||
| 6865 | 11년 전 | 1617 | ||
| 6864 | 11년 전 | 476 | ||
| 6863 | 11년 전 | 3751 | ||
| 6862 | 11년 전 | 1849 | ||
| 6861 | 11년 전 | 1647 | ||
| 6860 | 11년 전 | 1310 | ||
| 6859 |
cityman
|
11년 전 | 6815 | |
| 6858 | 11년 전 | 1271 | ||
| 6857 |
의정부아줌마
|
11년 전 | 874 | |
| 6856 | 11년 전 | 2376 | ||
| 6855 | 11년 전 | 1701 | ||
| 6854 | 11년 전 | 830 | ||
| 6853 | 11년 전 | 1210 | ||
| 6852 | 11년 전 | 2599 | ||
| 6851 | 11년 전 | 1976 | ||
| 6850 | 11년 전 | 1797 | ||
| 6849 | 11년 전 | 2085 | ||
| 6848 | 11년 전 | 2368 | ||
| 6847 | 11년 전 | 3146 | ||
| 6846 | 11년 전 | 2722 | ||
| 6845 | 11년 전 | 2801 | ||
| 6844 | 11년 전 | 3525 | ||
| 6843 | 11년 전 | 3267 | ||
| 6842 |
아트291
|
11년 전 | 696 | |
| 6841 | 11년 전 | 4172 | ||
| 6840 | 11년 전 | 5188 | ||
| 6839 | 11년 전 | 894 | ||
| 6838 |
|
11년 전 | 2097 | |
| 6837 | 11년 전 | 1278 | ||
| 6836 |
netdf
|
11년 전 | 615 | |
| 6835 |
|
11년 전 | 1011 | |
| 6834 | 11년 전 | 674 | ||
| 6833 |
|
11년 전 | 2687 | |
| 6832 |
울산굿모닝
|
11년 전 | 1663 | |
| 6831 |
|
11년 전 | 675 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기