I'm running a small script that takes a string from a database and then I'm trying to compare it to the server date, to see if it's in the future or past. I've managed this amount in my coding but I'm a bit stump on how to highlight if it's one week away etc.. E.g. I'm building a system for highlight stock being out of date, and I need to be able to give a weeks notice in the system, so I need to compare the date to the current server time and add like 7 days.. then will it be out of date.. etc.
Here's what I have, if anyone can help that'd be great.
Code: Select all
<td style="font-size:11px"><?php echo $row['Purchase_Date']; ?></td>
if (strtotime($sbd) < time())
'<td style="font-size:11px; background-color:#FF6666; font-weight:bold">
OUT OF DATE
else if (strtotime($sbd) > time())
Note: If you look closely, I've set the output as OUT OF DATE and changed the cell colour if the product is out of date.