The Wicked Coder

PHP, fun and all

Simple Calendar Script

Have you ever wanted to have a calendar or use a calendar for your own CMS as archive? here is a simple code to make your own calendar. You can style it with own CSS.

phpcalendar

You can checkout the demo in here




Calendar




1,"Mon"=>2,"Tue"=>3,"Wed"=>4,"Thu"=>5,"Fri"=>6,"Sat"=>7);
$arraymonth=array(
         1=>array("January",31),
         2=>array("February",28),
         3=>array("March",31),
         4=>array("April",30),
         5=>array("May",31),
         6=>array("June",30),
         7=>array("July",31),
         8=>array("August",31),
         9=>array("September",30),
        10=>array("October",31),
        11=>array("November",30),
        12=>array("December",31),
);
$leapyear=date("L", mktime(0, 0, 0, 1, 1, $year));
$arraymonth[2][1]+=$leapyear;

// ####################################################333
function print_month($Nodayoftheweek,$NoDaysMonth,$MonthName){
        print "\n\n";
        print "\n";
        print str_repeat("\n",$Nodayoftheweek-1);
        $Nodayoftheweek--;
        for($i=1; $i<$NoDaysMonth+1; $i++){
                if ($Nodayoftheweek==0){print "\n";}
                if ($Nodayoftheweek==0){
                        print "\n";
                }else{
                        print "\n";
                }
                $Nodayoftheweek++;
                if ($Nodayoftheweek==7){print "\n";$Nodayoftheweek=0;}
        }
        if ($Nodayoftheweek<7 and $Nodayoftheweek>0){
                while($Nodayoftheweek<7){
                        print "\n";$Nodayoftheweek++;
                }
                print "\n";
        }
        print "
".$MonthName."
 
".$i."$i
 

"; } ?>

 

><<  >< Year Calendar >>  >>>
 

Updated: June 29, 2013 — 5:33 pm
The Wicked Coder © 2014