Home › Forums › Front-end Issues › Date output › Reply To: Date output
Sorry to revive an old thread but I pulled your code from the example above;
<? if (get_field('date-start')) : ?> The next opportunities to undertake this workshop are: <br/> <? $format_in = 'yymmdd'; // the format your value is saved in (set in the field options) $format_out = 'D d MM'; // the format you want to end up with $date = DateTime::createFromFormat($format_in, get_field('date-start')); echo get_field('date-start'); //echo $date->format( $format_out ); echo '$date: <pre>'; print_r($date); echo '</pre>'; endif; ?>
The next opportunities to undertake this workshop are: 20150725$daten:
ie the date-start field is valid.
if I uncomment this line
//echo $date->format( $format_out );
I get a fatal error.
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!
The most recent ACF Chat Friday featured a live demo of how to register CPTs directly in the plugin, one of our most requested features. Check out the summary below for a replay of the demo, and don’t forget to register for the next session! https://t.co/k2KQ3WWBAz— Advanced Custom Fields (@wp_acf) March 9, 2023
© 2023 Advanced Custom Fields.