d

달력 출력하기

· 11년 전 · 1856
<HTML>
<HEAD>
<TITLE>title</TITLE>
</HEAD>
<STYLE type='text/css'>
A:link {color:black;text-decoration:none;}
A:visited {color:black;text-decoration:none;}
A:hover {color:#0066cc;text-decoration:none;}
p,br,body,td {font-size:9pt;}
color:#0099cc; background-color:white}
</STYLE>

<BODY>
<TABLE width = '100%' height = '100%'>
<TR>
<TD align = 'center'>
<?php

if (!$year)
$year = date("Y");
    if (!$month)
    $month = date("m");

$day = 1;
$spacer = spacer( $year, $month, $day );
$endday = array( 31, 28, 31, 30 , 31, 30, 31, 31, 30 ,31 ,30, 31 );

    if( $year%4 == 0 && $year%100 != 0 || $year%400 == 0 )
        $endday[1] = 29;
        else
        $endday[1] = 28;


echo("
    <FONT color='#0066cc'>${year}년</FONT>
    <TABLE>
    <TR>
    <TD colspan = 7>
    ");
    for( $i = 1; $i <= 12; $i++ )
    {
        if( $i == $month )
        {
        echo("<A href = '$PHP_SELF?year=$year&month=$i'><FONT color='red'>${i}월&nbsp;</FONT></A>");
        }
        else
        echo("<A href = '$PHP_SELF?year=$year&month=$i'>${i}월&nbsp;</A>");
    }
echo("
    </TD>
    </TR>
    </TABLE>
    
    <TABLE>
    <TR>
    <TD align='center'>일</TD>
    <TD align='center'>월</TD>
    <TD align='center'>화</TD>
    <TD align='center'>수</TD>
    <TD align='center'>목</TD>
    <TD align='center'>금</TD>
    <TD align='center'>토</TD>
    </TR>
    <TR>
    ");

for( $i = 0; $i < $spacer; $i++ )
{
    echo("
        <TD>&nbsp;</TD>
        ");
    $tr++;
}


for( $i = 1; $i <= $endday[$month-1]; $i++ )
{
    if( $tr % 7 == 0 )
    {
        echo("
        </TR>
        <TR>
        <TD align = 'right'>$i</TD>
        ");
        $tr++;

    }
    else
    {
        echo("
            <TD align = 'right'>$i</TD>
            ");
        $tr++;
    }
}

$next_year = $year + 1;
$priv_year = $year - 1;
$next_year_ten = $next_year + 9;
$priv_year_ten = $priv_year - 9;


echo("
    </TR>
    </TABLE>

    <A href = '$PHP_SELF?year=$priv_year_ten&month=$month'> << </A>
    &nbsp;&nbsp;&nbsp;&nbsp;
    <A href = '$PHP_SELF?year=$priv_year&month=$month'> [-1] </A>
    &nbsp;&nbsp;
    <A href = '$PHP_SELF?year=$next_year&month=$month'> [+1] </A>
    &nbsp;&nbsp;&nbsp;&nbsp;
    <A href = '$PHP_SELF?year=$next_year_ten&month=$month'> >> </A>

    ");

        
function spacer( $year, $month, $day )
{
    $spacer = array(0, 3, 2, 5, 0, 3, 5, 1, 4, 6, 2, 4);
    $year = $year - ($month < 3);
    $result = ($year + (int) ($year/4) - (int) ($year/100) + (int) ($year/400) + $spacer[$month-1] + $day) % 7;
    return $result;
}
?>
</TD>
</TR>
</BODY>
</HTML>
|
댓글을 작성하시려면 로그인이 필요합니다.

프로그램

+
제목 글쓴이 날짜 조회
11년 전 조회 2,382
11년 전 조회 1,357
11년 전 조회 5,487
11년 전 조회 2,535
11년 전 조회 3,254
11년 전 조회 2,110
11년 전 조회 1,156
11년 전 조회 2,215
11년 전 조회 2,365
11년 전 조회 2,047
11년 전 조회 1,656
11년 전 조회 1,164
11년 전 조회 2,030
11년 전 조회 2,786
11년 전 조회 1,484
11년 전 조회 2,995
11년 전 조회 1,938
11년 전 조회 4,694
11년 전 조회 2,028
11년 전 조회 2,690
11년 전 조회 3,915
11년 전 조회 1,796
11년 전 조회 2,637
11년 전 조회 1,014
11년 전 조회 2,045
11년 전 조회 4,679
11년 전 조회 1,825
11년 전 조회 2,055
11년 전 조회 964
11년 전 조회 1,364
11년 전 조회 1,687
11년 전 조회 1,801
11년 전 조회 1,670
11년 전 조회 2,434
11년 전 조회 1,367
11년 전 조회 3,278
11년 전 조회 3,465
11년 전 조회 2,016
11년 전 조회 4,973
11년 전 조회 1만
11년 전 조회 2,833
11년 전 조회 1,334
11년 전 조회 3,444
11년 전 조회 2,778
11년 전 조회 2,299
11년 전 조회 1,213
11년 전 조회 4,427
11년 전 조회 903
11년 전 조회 1,418
11년 전 조회 1,857
11년 전 조회 2,077
11년 전 조회 2,054
11년 전 조회 4,816
11년 전 조회 1,831
11년 전 조회 1,046
11년 전 조회 2,251
11년 전 조회 1,790
11년 전 조회 2,814
11년 전 조회 1,052
11년 전 조회 1,747
11년 전 조회 1,658
11년 전 조회 1,795
11년 전 조회 1,412
11년 전 조회 1,359
11년 전 조회 1,409
11년 전 조회 1,771
11년 전 조회 1,835
11년 전 조회 1,941
11년 전 조회 1,831
11년 전 조회 2,136
11년 전 조회 1,350
11년 전 조회 1,560
11년 전 조회 1,486
11년 전 조회 1,647
11년 전 조회 2,161
11년 전 조회 1,736
11년 전 조회 1,719
11년 전 조회 6,176
11년 전 조회 1,775
11년 전 조회 1,909
11년 전 조회 1,943
11년 전 조회 2,055
11년 전 조회 2,449
11년 전 조회 4,046
11년 전 조회 2,450
11년 전 조회 1,232
11년 전 조회 1,027
11년 전 조회 1,164
11년 전 조회 1,263
11년 전 조회 1,520
11년 전 조회 1.6만
11년 전 조회 1,629
11년 전 조회 782
11년 전 조회 814
11년 전 조회 1,064
11년 전 조회 3,342
11년 전 조회 1,180
11년 전 조회 949
11년 전 조회 995
11년 전 조회 854
🐛 버그신고