before you use the format function on the $date variable, can you please debug it’s value like so:
<?php echo '<pre>'; print_r( $date ); echo '</pre>'; die; ?>
Also, can you please debug the value of your date field like so:
<?php echo '<pre>'; print_r( get_field('class_date') ); echo '</pre>'; die; ?>
It is most likely that the date value is not in the correct format to be converted into the date-time object as your code is expecting. This debugging will highlight the issue
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
© 2022 Advanced Custom Fields.