I\’m successfully using the code below to color cells that contain a date that is at least three years in the past: … $threeYearsAgo = date(\’Y-m-d\’, strtotime(\’-3 years\’)); // If date is three years or more in the past, change CSS of cell $f = array(); $f[\”column\”] = \”date_capitalized\”; $f[\”op\”] = \”<=\”; $f[\”value\”] = $threeYearsAgo; //$f[\”cellclass\”] = \”focus-date\”; $f[\”cellcss\”] = \”\’background\’:\’rgba(255, 255, 0, 0.3)\’\”; //$f[\”css\”] = \”\’background-color\’:\’#ff0000\’, \’color\’:\’white\’\”; // Applies to the entire row, not just the cell $f_conditions[] = $f; … Two questions: The code above also changes the color of the cells if no date is present (i.e., NULL value). How can I edit the code to stop coloring cells that do not contain a date? How can I color the cells different colors based on date range? Yellow if the date is at least 3 years in the past. Orange if the date is at least 4 years in the past. Red if the date is at least 5 years or more in the paste.
I’m successfully using the code below to color cells that contain a date that is at least three years in the past:
…
$threeYearsAgo = date('Y-m-d', strtotime('-3 years'));
// If date is three years or more in the past, change CSS of cell
$f = array();
$f["column"] = "date_capitalized";
$f["op"] = "<=";
$f["value"] = $threeYearsAgo;
//$f["cellclass"] = "focus-date";
$f["cellcss"] = "'background':'rgba(255, 255, 0, 0.3)'";
//$f["css"] = "'background-color':'#ff0000', 'color':'white'"; // Applies to the entire row, not just the cell
$f_conditions[] = $f;
…
Two questions:
- The code above also changes the color of the cells if no date is present (i.e., NULL value). How can I edit the code to stop coloring cells that do not contain a date?
- How can I color the cells different colors based on date range?
- Yellow if the date is at least 3 years in the past.
- Orange if the date is at least 4 years in the past.
- Red if the date is at least 5 years or more in the paste.

