Support

Account

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>