hi
i was making calendar for my website some how using different tutorials i made it but i want to makes some changes but cant figer out can some one plz help me ...
i am also comparing emp date of leave if thats true then it will change the color of that date as well ..

i want calendar in this form
jan 1 2 3 4 ..... 30
fab 1 2 3 4 ..... 30
mar 1 2 3 4 ..... 30

dec 1 2 3 4 ..... 30

and sat, sun show as weekend with different color

plz plz help me

$month = 1;
$year = $_REQUEST["year"];
$day = date("j");

$currentTimeStamp = strtotime("$year-$month-$day");
$monthName = date("F", $currentTimeStamp);
$numDays = date("t", $currentTimeStamp);
$counter = 0;
/*$numEventsThisMonth = 0;
$hasEvent = false;
$todaysEvents = "";*/
?>
    <div class="outerbox" style="width:490px;float:left;">
        <div class="mainHeading" ><h2><?php echo $lang_Leave_Select_Employee_Title;?></h2></div>


<table width='175' border='0' cellspacing='0' cellpadding='0' class="body">
    <tr>
        <td width='125' align="center" colspan='5'>
        <span class='title'><?php echo $monthName . " " . $year; ?></span><br>
        </td>
    </tr>
<?php for($month; $month <=12;$month++) { ?>
    <tr>
        <td class='head' align="center" width='25'>Su</td>
        <td class='head' align="center" width='25'>Mo</td>
        <td class='head' align="center" width='25'>Tu</td>
        <td class='head' align="center" width='25'>We</td>
        <td class='head' align="center" width='25'>Th</td>
        <td class='head' align="center" width='25'>Fr</td>
        <td class='head' align="center" width='25'>Su</td>        
    </tr>
    <tr>
<?php
// Get values from query string
//$day = $_REQUEST["day"];
//echo $day;

    for($i = 1; $i < $numDays+1; $i++, $counter++)
    {	//echo $counter.'-<br/>';
        $timeStamp = strtotime("$year-$month-$i");
		//echo $timeStamp.'-<br/>';
        if($i == 1)
        {
        // Workout when the first day of the month is
        $firstDay = date("w", $timeStamp);
       
        for($j = 0; $j < $firstDay; $j++, $counter++)
        echo "<td> </td>";
        }
       
        if($counter % 7 == 0)
        echo "</tr><tr>";
       
        if(date("w", $timeStamp) == 0)

        $class = "class='weekend'";
        else
        if($i == date("d") && $month == date("m") && $year == date("Y"))
        $class = "class='today'";
        else
        $class = "class='normal'";
		echo $i.'--';
        echo "<td class='tr' bgcolor='#ffffff' align='center' width='25'><font $class>$i</font></td>";
		//echo '<br/>';
    }
	}
?>
    </tr>
</table>

make some changes and done but need help to change the color of weekdays sat and sunday ..

$monthNames = Array("January", "February", "March", "April", "May", "June", "July", 
"August", "September", "October", "November", "December");

	$cMonth = 1;
	$cYear = $_REQUEST["year"];

	$prev_year = $cYear;
	$next_year = $cYear;
	$prev_month = $cMonth-1;
	$next_month = $cMonth+1;

	if ($prev_month == 0 ) {
		$prev_month = 12;
		$prev_year = $cYear - 1;
	}
	if ($next_month == 13 ) {
		$next_month = 1;
		$next_year = $cYear + 1;
}
?>
    <div class="outerbox" style="width:730px;float:right;margin-right:20px;" >
        <div class="mainHeading" ><h2><?php echo $lang_Leave_Select_Employee_Title;?></h2></div>
		

<?php for($cMonth;$cMonth <=12;$cMonth++) { ?>
<table width="50%" border="0" cellpadding="2" cellspacing="2">
<tr align="center">
<td width="10" colspan="7" bgcolor="#999999" style="color:#FFFFFF"><strong><?php echo $monthNames[$cMonth-1].' '.$cYear; ?></strong></td>

<?php 
$timestamp = mktime(0,0,0,$cMonth,1,$cYear);
$maxday = date("t",$timestamp);
$thismonth = getdate ($timestamp);
$startday = $thismonth['wday'];
for ($i=0; $i<($maxday+$startday); $i++) {
	if(($i % 7) == 0 ) {  }
	if($i < $startday) { echo "<td ></td>"; }
	else{ echo ($i - $startday + 1); }
	if(($i % 7) == 6 ) { echo "</tr>"; }
}
?>
</table>
Member Avatar for diafol

You could use something like:

tr + tr + tr + tr + tr + tr{background-color:grey;}

for sat/sun if these are your last two days in the table.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.