I have made a custom theme and used CPT UI to create Event Post Type and ACF to create Event Date Field. I am using following code to display Remaining Event Days in frontend:
$event_date = strtotime(get_field('event_date', false, false));
$curr_date = time();
$rem_days = $event_date - $curr_date;
if ($rem_days <= 0) {
$event_msg = '<strong>Event Expired</strong>';
} else {
$event_msg = '<strong>' . date('d', $rem_days) . '</strong> Days Remaining';
}
The problem is events in this month are having right remaining days but events with next months are displaying less remaining days.
I don't know what I am missing out. Can you guys please help me?
You can see in screenshot Event with Oct 12 is displaying 23 days remaining, which is right. But event with Nov 3 is displaying just 14 days.