I need solution for rows conditional formatting (background) based on time now and time difference, before 48 hours, 84 For example: if in cell is today's date and time 13:00 /background color =#ffffff if in cell value is -48 hours different color if in cell value is -84 different color. Here is what I have
<?php
$con = mysqli_connect("localhost", "test", "test");
    if (!$con) {
        die("Database Connection failed".mysqli_error());
    } else {
        $db_select = mysqli_select_db($con, 'test2');
        if (!$db_select) {
            die("Database selection failed".mysqli_error());
        } else {
        }
    }
$records = mysqli_query($con, "SELECT * FROM test2 ORDER by user_Name");
$timenow = new DateTime();
?>
<!DOCTYPE html>
<html>
<body> 
<table width="500" border="2" cellpadding="2" cellspacing='1'>
    <tr bgcolor="#2ECCFA">
        <th>User</th>
        <th>Device</th>
        <th>Last Contact</th>
    </tr>
<?php
if ($records) {
    while ($row = mysqli_fetch_assoc($records)) {
        $calc = $timenow - $row['date'];
        if ($calc > 12000) {
            $rowClass = "oldOrder";
        } else {
            $rowClass = "normalOrder";
        }
        echo '<tr class="'.$rowClass.'"><td>';
        echo $row['user_name'] . '';
        echo '</td><td>';
        echo $row['Device_ID'] . '';
        echo '</td><td>';
        echo $row['Last_Contact'] . '';
        echo '</td></tr>';
    }
}
?>
    <a href=”rowClass.css” rel=”stylesheet” type=”text/css”>
</table>
Field in DB date is additional column that is set as DATETIME I keep getting error
Notice: Object of class DateTime could not be converted to int in bla/bal line 50 that is this part
while ($row = mysqli_fetch_assoc($records)) {
    $calc = $timenow - $row['date'];
    if ($calc > 3) {
        $rowClass = "oldOrder";
    } else {
        $rowClass = "normalOrder";
 
     
     
    