このブログを検索

2011/05/23

カレンダー

その日の前の週と翌週を含めた3週間を表示する。

@weekday = qw /Sun Mon Tue Wed Thu Fri Sat/;

print "<table border=1><tr>";

foreach(@weekday){
    print "$_<\/td>";
}

( $sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst )
=  localtime ( time );

$last = ($wday + 7) * -1;


$d=$last;
for($j=0;$j<21 24="" 3600="" d="" hour="" if="" isdst="" j="" localtime="" mday="" min="" mon="" print="" sec="" time="" tr="" wday="=0){" yday="" year="">";
    }
    print "

";
    printf("%2d/%2d ",$mon+1,$mday);
    print "<\/d>";

    if($wday==6){
        print "<\/tr>\n";
    }
    $d++;
}

print "<\/tr><\/table>";