如何在当前PC时间等于存储在var中的结束时间时重新加载页面

I'm doing a kind of a slideshare, all infos comming from a mysql DB, and my problem is, I want to refresh the page when the "$hora_fim" (end hour to be more specific) be equal to the current pc time "$hora" (hour). So, I was thinking about a WHile statment, but that only repeat my code till the 2 hours became equal to each other. If I do an If statment that will only be read once by the browser. SO what I really want. I will give an example:

There are 3 images in the slide share, and they have an end hour, and when that hour comes, like, their end hour its at 3:00PM and there is only 2:00PM the current PC time, when the PC time beacame 3:00PM (the end hour and the current time will be equal) the page will refresh to load other 3 images.

So the logic is: When the end hour became equal to the current pc time, the page will auto refresh. I need a When statment but I dont know how to do it..

Btw, dont try to run the code, It will not run, because the code its all in one.

<?php
            //Obter nome
              $nome = gethostbyaddr($_SERVER['REMOTE_ADDR']);
             $ipv4 = $_SERVER['REMOTE_ADDR'];


            //Data e hora atual
            date_default_timezone_set('Europe/Lisbon');
            $timezone = date_default_timezone_get();

            $date = date('Y/m/d', time());
            $horas = date('H:i:s', time());

             $mac_mupi_pesquisa = "SELECT ipv4 FROM mupis WHERE ipv4 = '". $ipv4 ."' ";
                $resultado_mac_mupi_pesquisa = mysqli_query($conn, $mac_mupi_pesquisa);

                $array = mysqli_fetch_array($resultado_mac_mupi_pesquisa);
                $mac_mupi_array = $array['ipv4'];

                if($mac_mupi_array == $ipv4){

                  /* procura */ //
                  $pesquisar_publicidade="SELECT * FROM agenda WHERE agenda.ipv4 = '". $ipv4 ."' AND agenda.data_ini <= '". $date ."' AND agenda.data_fim >= '". $date ."' and  agenda.hora_ini <= '". $horas ."'and  agenda.hora_fim >= '". $horas ."'";

                  /* executar a consulta */
                  $result = mysqli_query($conn, $pesquisar_publicidade);

                  /* contar o número de linhas da comsulta */
                  $nr_linhas = mysqli_num_rows($result);
                  /* se não encontrou nenhuma linha */

                  if($nr_linhas == 0){

                    $pesquisar_publicidade2 ="SELECT * FROM agenda WHERE agenda.nome = '". $nome ."' AND agenda.data_ini <= '". $date ."' AND agenda.data_fim >= '". $date ."' and  agenda.hora_ini <= '". $horas ."'and  agenda.hora_fim >= '". $horas ."'";

                  /* executar a consulta */
                  $result2 = mysqli_query($conn, $pesquisar_publicidade2);

                  /* contar o número de linhas da comsulta */
                  $nr_linhas2 = mysqli_num_rows($result2);
                  /* se não encontrou nenhuma linha */

                  ?>

                    <!--Design se nao houver pub-->
                        <div id="fullpage">

                            <div class="section " id="section0">
                                    <img class="imagem" id="bg" src="assets/img/publicidade.svg"/> 
                                <div class="layer">
                                    <h1>BE-MUPIE</h1>
                                </div>
                            </div>

                        </div>

                        <meta http-equiv="refresh" content="30">


<?php

        }else{

                while($linha = mysqli_fetch_array($result, MYSQLI_ASSOC)){


                    $hora_ini =  new DateTime ($linha['hora_ini']);
                    $hora_fim =  new DateTime ($linha['hora_fim']);


                $tempo_da_publicidade = $hora_fim->diff($hora_ini);
                $tempo_da_publicidade ->format("%H:%I:%S");

                $refresh = ( ($tempo_da_publicidade ->format("%H")*3600) +($tempo_da_publicidade ->format("%I")*60) + ($tempo_da_publicidade ->format("%S") )) ; 



                //Se o conteudo for um video-

                $video = "SELECT if ( '". $linha['conteudo'] ."' LIKE '%.mp4', 'SIM', 'NAO') as result FROM agenda LIMIT 1";  

                    /* executar a consulta */
                    $result_video = mysqli_query($conn, $video);

                    /* contar o número de linhas da comsulta */
                    $nr_linhas_video = mysqli_num_rows($result_video);
                    /* se não encontrou nenhuma linha */

                    $linha2 = mysqli_fetch_array($result_video, MYSQLI_ASSOC);

                        $linha2['result'] == "SIM";

                        //Conta o que tem dentro do array
                        $count_conteudo = 0;
                        $tempo_por_cada_conteudo = 0;
                        $imagens_todas = array($linha['conteudo'], $linha['conteudo2'], $linha['conteudo3']);

                            foreach ($imagens_todas AS $check)
                                //ex: de código
                                if ($check != '') {
                                        $count_conteudo += 1;

                                            $tempo_por_cada_conteudo = $refresh / $count_conteudo ;


                                }




        /*    if($linha2['result'] == "SIM"){ */


       ?>


    <!--Design com pub-->
        <div id="fullpage">

        <div class="section " id="section0">
            <img class="imagem" id="bg" src="includes/mupis/mupi_cont/<?php echo $linha['conteudo'] ;?>" /> 
            <div class="layer">
                <h1>IMAGEM</h1>
            </div>
        </div>

        <div class="section " id="section1">
            <img class="imagem" id="bg" src="includes/mupis/mupi_cont/<?php echo $linha['conteudo2'] ;?>" /> 
            <div class="layer">
                <h1>IMAGEM</h1>
            </div>
        </div>

        <div class="section " id="section2">
                    <img class="imagem" id="bg" src="includes/mupis/mupi_cont/<?php echo $linha['conteudo3'] ;?>" /> 
            <div class="layer">
                <h1>IMAGEM</h1>
            </div>
        </div>

        </div>


    <?php 



    ?>

<script>
    w3.slideshow(".section", <?php echo $tempo_por_cada_conteudo; ?>);
</script>

<?php

            ?>
                    <meta http-equiv="refresh" content="30"> <!--Quando as horas forem diferentes, 
                                                                                                                    dão refresh à página-->
            <?php

                                }   //Fim do switch

                        } 
            ?>



            <?php   

                }

            }

        ?>  





</body>

<script type="text/javascript" src="assets/mupi-assets/dist/fullpage.js"></script>
<script type="text/javascript" src="assets/mupi-assets/examples/examples.js"></script>
<script src="https://www.w3schools.com/lib/w3.js"></script>


<script type="text/javascript">
    var myFullpage = new fullpage('#fullpage', {
        verticalCentered: true,
        sectionsColor: ['#1bbc9b', '#4BBFC3', '#7BAABE']
    });
</script>
</html>

In JavaScript, you can use

// Year, Month 0-11, Day, Hour, Min (Optional: sec, ms)
var eta_ms = new Date(2020, 4, 14, 0, 0).getTime() - Date.now();
var timeout = setTimeout(function(){
    // TODO: This will run at the date above!
}, eta_ms);