This topic is locked

Conditional Formatting based on DATE

1/26/2012 12:15:39 PM
PHPRunner General questions
D
DigitalDean8 author

Can anyone help me troubleshoot this custom formatting? I am simply trying to change the font color based on if a date field value is equal to today's date. The code I am trying to use is:
============================================================================

$d=date()

if ($value = $d) {

$color="red";

} else {

$color="black";

}

$value="<span style='color: " . $color . ";'>$value</span>";
=============================================================================
However I get a syntax error. I am sure it's simple but don't quite know how to fix it.
Any help is appreciated.

Dean

C
cgphp 1/26/2012


if ($value == date('Y-m-d'))

{

$color="red";

}

else

{

$color="black";

}

$value = "<span style='color: " . $color . ";'>".$value."</span>";