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;
?>
Outputs;
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.
PHP 5.5
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!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.