In the menu Format
> Conditional formating...
>
you can select the option date is
, date is before
, date is after
apply a condition today
, tomorrow
, exact date
... and then apply a color to these conditions
So in your case you need to apply a color that will be by defect green and add a conditional formating that say if the timestamp is over yesterday then apply color red
EDIT
to compare two timestamp, you can also use the above trick, with a little modifications:
you need to tag in red the cell if it have "!". In the cell, write this formula: =if(E3-E4>1;E3;TEXT(E3;"mm/dd/yyyy hh:mm:ss")&" !")
with E3 and E4 the cell where you wrote the two timestamp. you can hide the cell E3 to avoid having the result in duplicate.
otherwise, you'll need to set an app script in your spreadsheet for example:
function compareDate(){
var ts1 = SpreadsheetApp.getActiveSheet().getRange("E3").getValue();
var ts2 = SpreadsheetApp.getActiveSheet().getRange("E4").getValue();
var time1=new Date(ts1).getTime();
var time2=new Date(ts2).getTime();
if((time1+86400000)<time2){
SpreadsheetApp.getActiveSheet().getRange("E3").setBackground("red");
}
}