Display a pdf file for 4 hours

Hi, I wanted to show or hide a pdf file on my page, it’s a lunch menu and there is another evening menu. So I didn’t want it to show up at the same time.
Thank you for your reply

So use JS .getHours() methods to check the time and change the PDF source in accordance.

thank you for your reply, can you write a little example please. thank you a lot

@prodfenris

const currentHour = new Date().getHours();
if(currentHour >= 6 && currentHour  < 18){
$("#pdfIframe").src = "https://somedomain.com/day.pdf");
} else {
$("#pdfIframe").src = "https://somedomain.com/evening.pdf");
}

@jonatandor35 thanks a lot, i tried pasting the script into the code, changing the name but it’s giving me an error. I am not a programmer so I try as I can