d

달력 출력하기

· 2014-04-27 (일) 02:11:58 · 4552
<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}월 </FONT></A>");
        }
        else
        echo("<A href = '$PHP_SELF?year=$year&month=$i'>${i}월 </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> </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>
        
    <A href = '$PHP_SELF?year=$priv_year&month=$month'> [-1] </A>
      
    <A href = '$PHP_SELF?year=$next_year&month=$month'> [+1] </A>
        
    <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>
|
댓글을 작성하시려면 로그인이 필요합니다.

프로그램

8,188건
+
제목 글쓴이 날짜 조회
16-07-13 조회 2,069
16-07-12 조회 2,202
16-07-12 조회 2,222
16-07-11 조회 2,105
16-06-05 조회 2,659
16-06-03 조회 2,761
16-05-26 조회 2,717
15-09-22 조회 4,843
15-06-10 조회 4,645
14-10-25 조회 6,080
14-10-22 조회 8,823
14-09-21 조회 5,617
14-09-16 조회 4,910
14-08-22 조회 1만
14-08-13 조회 5,742
14-08-12 조회 5,287
14-08-12 조회 6,151
14-08-11 조회 6,681
14-06-12 조회 6,040
14-06-11 조회 4,895
14-05-09 조회 5,267
14-05-09 조회 6,226
14-05-09 조회 6,245
14-05-08 조회 5,570
14-04-17 조회 4,551
14-04-16 조회 4,425
14-04-15 조회 4,397
14-04-15 조회 4,424
14-04-15 조회 4,080
14-04-14 조회 4,130
14-04-14 조회 4,092
14-04-14 조회 4,511
14-04-14 조회 4,516
14-04-14 조회 4,564
14-04-13 조회 4,397
14-04-12 조회 4,103
14-04-12 조회 4,189
14-04-12 조회 4,270
14-04-11 조회 4,787
14-04-10 조회 4,459
14-04-10 조회 4,485
14-04-09 조회 4,764
14-04-09 조회 5,091
14-04-08 조회 6,703
13-10-30 조회 7,511
13-07-11 조회 4,991
13-03-28 조회 1.1만
13-02-27 조회 6,575
13-02-14 조회 5,407
13-01-10 조회 4,400
12-12-31 조회 4,928
12-12-20 조회 6,031
12-12-12 조회 5,167
12-12-07 조회 4,343
12-11-28 조회 4,663
12-11-22 조회 5,128
12-11-12 조회 5,454
12-09-22 조회 4,426
12-09-18 조회 4,612