"; $GoToDay = $HTTP_GET_VARS['txtDay']; if(!empty($GoToDay)) { $StartDate=date("m/d/y",strtotime ("$GoToDay")); } else { if(empty($StartDate)) { $StartDate=date("m/d/y"); } } echo WriteMonth($StartDate); function WriteMonth($StartDate) { $WriteMonth=""; // for returning the value of the whole string $CurrentDate=date("m/1/y", strtotime ("$StartDate")); //the date of what ever value is recieed will be stored here $setMonth=date("m",strtotime ($CurrentDate)); $todaysDate=date("j",strtotime(date("m/d/y"))); //for storing todays date $mmon=date("m",strtotime ($CurrentDate)); //for storing month $myear=date("Y",strtotime ($CurrentDate)); //for storing year $noOfDays=date("t",strtotime ($CurrentDate)); //for storing number of days in a month $WriteMonth.=""; $WriteMonth.=" | colspan=\"2\" valign=top align=\"left\">"; $WriteMonth.="("$CurrentDate -1 months"))."\">color=\"#6699cc\">Prevhref=\"left.php?txtDay=".date("m/1/y", strtotime ("$StartDate months"))."\">".date("F",strtotime ($StartDate))." ".date("Y",strtotime ($StartDate)); $WriteMonth.=" | "; $WriteMonth.="("$StartDate +1 months"))."\">color=\"#6699cc\">Next"; $WriteMonth.=" | "; $WriteMonth.="S | "; $WriteMonth.="M | "; $WriteMonth.="T | "; $WriteMonth.="W | "; $WriteMonth.="T | "; $WriteMonth.="F | "; $WriteMonth.="S | "; $WriteMonth.=" "; $startMonth=date("$myear/$setMonth/01"); $endMonth=date("$myear/$setMonth/$noOfDays"); $WriteMonth .= ""; for($i=1;$i<=$noOfDays;$i++) { $coolmonth=date("$setMonth/$i/$myear"); $TBD=date("j",strtotime ($coolmonth)); $BD=date("j",strtotime ($coolmonth)); $BDay=date("D",strtotime ($coolmonth)); if ($todaysDate==$TBD) { $BD= "$TBD"; } $BD = "$BD | "; switch($BDay){ case 'Sun': $WriteMonth .= "$BD"; break; case 'Mon': if($TBD==1) $WriteMonth .= " | "; $WriteMonth .= "$BD"; break; case 'Tue': if($TBD==1) $WriteMonth .= " | | "; $WriteMonth .= "$BD"; break; case 'Wed': if($TBD==1) $WriteMonth .= " | | | "; $WriteMonth .= "$BD"; break; case 'Thu': if($TBD==1) $WriteMonth .= " | | | | "; $WriteMonth .= "$BD"; break; case 'Fri': if($TBD==1) $WriteMonth .= " | | | | | "; $WriteMonth .= "$BD"; break; case 'Sat': if($TBD==1) $WriteMonth .= " | | | | | ; | "; $WriteMonth .= "$BD"; $WriteMonth .=" "; break; } } $WriteMonth .=" "; return $WriteMonth; } echo " |
";