重置的PHP倒计时

I have a coding matter i need your aid with. I have attempted to solve it for a few days, but all it results in is frustration. I haven't found any existing examples or help on the internet, and all i have done so far is staring at my code, my mind blank.

I need a countdown to 17:00 (5 PM) each day, echoing a message saying that a certain amount of time is remaining until 17:00. After 17:00, i want to echo another message. Then, the timer needs to reset after 23.59. How can i do this with PHP?

Any help would be appreciated! Below is the code i already have, but i don't think any part of it would affect what i need help with:

<?php
    session_start();

    #ADD ITEM
    if( isset( $_POST['newitem'] ) ){
        $_SESSION['todo'][]=$_POST['newitem'];
    }


    #REMOVE ITEM
    if( isset( $_POST['remove_id'] ) ){
        $id = $_POST['remove_id'];
        unset( $_SESSION['todo'][$id] );
    }
?>
<html>
    <head>
        <title></title>
    </head>
    <body>
<?php
    $i = 0;

    echo "<h1>To Do</h1>";

    #SUBMIT
    echo "
    <form action='' method='post'>
        <input type='text' name='newitem'>
        <input type='submit'>
    </form>
    ";


    foreach( $_SESSION['todo'] as $id => $item ){
        $i++; 

        #REMOVE
        echo "
            <form action='' method='post'>
                <input type ='hidden' name='remove_id' value='$id'>
                <input type='submit'  value='-'>
                $item
            </form>";
    }

    echo $i;

    #CHANGE BACKGROUND COLOR DEPENDING ON DAY
    $day=date("l");

    switch($day) {
        case 'Monday':
            $bg_color = "red";
            break;
        case 'Tuesday':
            $bg_color = "blue";
            break;
        case 'Wednesday':
            $bg_color = "purple";
            break;
        case 'Thursday':
            $bg_color = "gray";
            break;
        case 'Friday':
            $bg_color = "yellow";
            break;
        case 'Saturday':
            $bg_color = "green";
            break;
        case 'Sunday':
        default:
            $bg_color = "beige";
            break;
    }

    echo "<body style='background-color:$bg_color'>";
?>
    </body>
</html>

I need a countdown to 17:00 (5 PM) each day, echoing a message saying that a certain amount of time is remaining until 17:00. After 17:00, i want to echo another message. Then, the timer needs to reset after 23.59. How can i do this with PHP?

if(date("H") < "17") echo "There are " . (16 - date("H")) . " hours and " . (60 - date("i")) . " minutes left until 17:00.";
else if(date("H") == "17" && date("i") == "00") echo "It is 17:00.";
else echo "17:00 is over for today.";