Reputation: 55
How can I show a div
with a range of dates excluding the year
Example:
//check today
$today = date('d-m');
$start_date = '01-04';
$end_date = '30-04';
if ( $start_date > $today && $end_date < $today ) {
echo 'OK';
} else {
echo 'NONE';
}
What is the best solution to do that in PHP?
Upvotes: 1
Views: 942
Reputation: 2893
Try representing your dates in the format "mm-dd". So
$today = date('m-d');
$start = '04-01';
$end = '04-30';
if ($start <= $today && $end >= $today) {
// Today's date lies between the start and end dates
}
Upvotes: 3