Need help understanding why this doesn't work. I have a text that's only visible on a given start date and time and gets removed on ended date and time.
This is the code I am using that works just fine. The text is visible for a month without problems:
<?php
if ( date('Y/m/d H:i') >= "2017/04/06 08:00" &&
date('Y/m/d H:i') <= "2017/05/06 20:00" ) {
echo "$text_1";
} else {
echo "$text_2";
}
?>
This is how I would like to be able write the date but it doesn't work as it supposed to:
<?php
if ( date('d/m/Y H:i') >= "06/04/2017 08:00" &&
date('d/m/Y H:i') <= "06/05/2017 20:00" ) {
echo "$text_1";
} else {
echo "$text_2";
}
?>
It doesn't take into account the month or year. Why is that? This would only show the text for one day and not for a month.