Jump to content

comparing dates


Recommended Posts

Hi, I could do with a bit of help with this, not sure where I'm going wrong. The following code is used to change the colour of a row based on date. I want to compare to todays date with the following results


If < today (turns red)

if == today (turns orange)

if > today (turns green)


I have included a screen shot of result I'm getting with below if statement

	$requireddate = date('l jS F',$row_rsActiveQuotes['quote_requireddate']);
	//this is anthing before today's date
 	if  ($today < $requireddate)
 	echo '<tr class="tableBody2">'; 
	//this is anthing with today's date
 	elseif ($today == $requireddate) 
	echo '<tr class="tableBody3">'; 
	//this is anthing with today's date
 	elseif ($today > $requireddate) 
	echo '<tr class="tableBody1">'; 
	else //this is anthing from tommorow
 	echo '<tr class="tableBody4">'; 


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.

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.