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 >>  >>>
 

Author: Ashif

Hi, my name is Ashif. I've been earning a living online since 2006 and love to share what I've learned. You can connect with me on Facebook, Twitter, YouTube and Google Plus. Don't forget to subscribe to my blog to keep up with my latest tips and tricks. You can also send questions in my mail.

Leave a Reply

Your email address will not be published. Required fields are marked *