<?php /* Online PHP Examples with Source Code website: http://4evertutorials.blogspot.in/ */ $day = date('j'); //what day is it today $month = date('n'); //what month are we in? $year = date('Y'); //what year are we in? //get the first first day of the month $first_day_of_month = date('w',mktime(1,1,1,$month,1,$year)); $days_in_month = date('t'); //how many days in this month print "SU\tMO\tTU\tWE\tTH\tFR\tSA
"; //print the weekday headers //count ahead to the weekday of the first day of the month for ($spacer = 0; $spacer < $first_day_of_month; $spacer++) { print " \t"; } for ($x = 1; $x <= $days_in_month; $x++) { //begin our main loop //if we have gone past the end of the week, go to the next line if ($spacer >= 7) { print "
"; $spacer = 0; } //if the length of the current day is one, put a "0" in front of it if (strlen($x) == 1) { $x = "0$x"; } if ($x == $day) { //is this day the current day print "$x\t"; //if so put an indicator } else { print "$x\t"; //otherwise just print it } $spacer++; //increment our spacer } ?>
Saturday, August 24, 2013
Calendar Script PHP
8/24/2013
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment