Home › Forums › General Issues › Display day and month from date_picker field. › Reply To: Display day and month from date_picker field.
I think I got it, or at least it is working now. I changed into the datepicker field options from 14/09/2915 to d/m/Y (I wrote it manually, I don’t know why selecting the 14/09/2015 option didn’t work).
And now using this code is working fine:
<div class="col-sm-3">
<?php
if(get_field('fecha_del_evento'))
{
$datetime = DateTime::createFromFormat('d/m/Y', get_field('fecha_del_evento'));
$fecha_dia = $datetime->format('d');
$fecha_mes = $datetime->format('M');
}
?>
<div class="eventos row">
<div class="col-xs-3">
<div class="fecha">
<p class="mes"><?php echo $fecha_mes; ?></p>
<p class="dia"><?php echo $fecha_dia; ?></p>
</div>
</div>
<div class="col-xs-9">
<?php the_content (); ?>
</div>
</div>
</div>
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.