Jump to content

PHP highlight dates between two dates on calender


kamal213

Recommended Posts

Hi guys,

 

I am trying to do a multidates events availability calender. The script below indicates todays date by highlighting an orange colour and also indicates the start and end date of the event highlighting grey colour on the two dates (The colour are link via css classes as shown).

//Today's date 
					$todaysDate = date("d/m/Y");
		            $dateToCompare = $daystring . '/' . $monthstring . '/' . $year;
					echo "<td align='center' ";
					if($todaysDate == $dateToCompare){
					echo "class='today'";
					}else{
					//Compare's the event dates
					$sqlcount = "select event_start,event_end from b_calender where event_start ='".$dateToCompare."' AND event_end='".$dateToCompare."'";
					$noOfEvent = mysql_num_rows(mysql_query($sqlcount));
					if($noOfEvent >= 1){
					echo "class='event'";
					}
					}

 

It works ok i.e. if start date = 01/01/2012 and end date = 04/01/2012 both date will be highlighted with grey colour. However I want it to also highlight grey on the dates between the 1st and 4th to show that then anydates between the 1st and 4th are not available and this is when I'm stuck.

 

Please guys I need help.

 

Thanks

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.