외국 소스 입니다.
윤달 윤년 확실히 표기하며, 정확합니다. mktime,date 등 지식만 있다면 공부 하시면 됩니당^^
소스 중간 중간이 hard 옵션으로 잘려 아래쪽으로 된것이 있습니다.
1줄로 사용하시면 됩니다.
php소스코드 & lib 에 올리겠습니다.
<?
// below is the code snippet for the calendar() function which is located and
called from mainfile.php
function Calendar() {
// list of names for days and months
$days = array("일", "월", "화", "수", "목", "금", "토");
$months = array
("", "January", "February", "March", "April", "May", "June", "July", "August", "Sep
tember", "October", "November", "December");
// number of days in each month
$totalDays = array(0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
// set up some variables to identify the month, date and year to display
if(!$currYear) { $currYear = date("Y"); }
if(!$currMonth) { $currMonth = date("n"); }
if(!$currDay) { $currDay = date("j"); }
// if leap year, modify $totaldays array appropriately
if (date("L", mktime(0,0,0,$currMonth,1,$currYear)))
{
$totalDays[2] = 29;
}
// set up variables to display previous and next months correctly
// defaults for previous month
$prevMonth = $currMonth-1;
$prevYear = $currYear;
// if January, decrement year and set month to December
if ($prevMonth < 1)
{
$prevMonth=12;
$prevYear--;
}
// defaults for next month
$nextMonth = $currMonth+1;
$nextYear = $currYear;
// if December, increment year and set month to January
if ($nextMonth > 12)
{
$nextMonth=1;
$nextYear++;
}
// get down to displaying the calendar
// find out which day the first of the month falls on
$firstDayOfMonth = date("w", mktime(0,0,0,$currMonth,1,$currYear));
$x=0;
$dateList=array();
?>
<< |
<? echo $months[$currMonth] . " " . $currYear; ?
> |
>> |
<?
for ($x=0; $x
1
Copyright ⓒ 2000-2026 BCPARK Inc. All Right Reserved.
