Formatting date output with Advanced custom fields in wordpress

I am struggling to get the date to output (at all!)

I have the following and I want the date to be output like 26th May 2014

Read More
            <p><?php the_field('description'); ?></p>
        <?php $date = DateTime::createFromFormat('Ymd', get_field('when')); ?>
        <h2><?php echo $date->format('d-m-Y'); ?></p>

All the above is inside a wordpress loop
Even if I move the variable declaration outside the loop, it still doesn;t work.

thanks

Related posts

Leave a Reply

1 comment