Assuming you have a custom datetime field with the slug ‘date_time,’ here’s how you can show the date and if the date is today or tomorrow, show that instead:
<?php // The event date $eventdate = strtotime(get_field('date_time')); // Today's date $today = strtotime('now'); // Tomorrow's date $tomorrow = strtotime('tomorrow'); // If event date is equal to today's date, show TODAY if (date('m-d-Y', $today) == date('m-d-Y', $eventdate)) { echo 'Today'; } // If event date is equal to tomorrow's date, show TOMORROW if (date('m-d-Y', $tomorrow) == date('m-d-Y', $eventdate)) { echo 'Tomorrow'; } // If event date is not equal to today's or tomorrow's date, print the date if ( (date('m-d-Y', $today) != date('m-d-Y', $eventdate)) && (date('m-d-Y', $tomorrow) != date('m-d-Y', $eventdate)) ) { echo date('M j', $eventdate); } ?> |