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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.