honkmaster Posted June 5, 2015 Share Posted June 5, 2015 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 <?php $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">'; } ?> Quote Link to comment Share on other sites More sharing options...
Barand Posted June 5, 2015 Share Posted June 5, 2015 Dates have to be in yyyy-mm-dd format to perform comparisons Quote Link to comment Share on other sites More sharing options...
honkmaster Posted June 5, 2015 Author Share Posted June 5, 2015 I new that as well, can't see wood for trees sometimes, thanks Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.