Answer the question
In order to leave comments, you need to log in
How to use PHP or JS to show a div on specific days?
Welcome all!
For example I have a div, I want to show this div every year from November 21st to 25th.
How to implement this with PHP or JS?
Answer the question
In order to leave comments, you need to log in
$today = strtotime(date("Y-m-d"));
$begin = strtotime(date("Y-11-21"));
$end = strtotime(date("Y-11-25"));
if($today >= $begin && $today <= $end) {
echo "Показываем div";
}
Php
<? If(date("m") == "11" and (21 <= intval(date("d")) <= 25):?>
Div some ....
<?endif;?>
The principle is this. But in general, there are mechanisms in the site engine, it is better to use them.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question