Support

Account

Home Forums General Issues Date-Formatting using 2 Dates

Helping

Date-Formatting using 2 Dates

  • Hello Folks,

    trying to archive a post page filtered by date-picker item ‘reisedatum_von’. In order to get the array to work date-formatting is default ‘yymmdd’.
    I also want to show ‘reisedatum_von’ and a second date-picker-field ‘reisedatum_bis’ under the post in the following format ’01. Apr 2014′. Tried to get it using the “Format value ( PHP < 5.3)-Tutorial” but it didn’t work.

    Can anybody help me?

    You find my .php file in the attachment.

  • You should be able to hook into the admin footer and add in any kind of datepicker option as you need by field ID:

    /**
     * Modify ACF Datepicker Formatted Field
     *
     * @return void
     */
    function theme_prefix_admin_footer() {
    
    	?>
    
    		<script>
    
    			jQuery( document ).ready( function( $ ) {
    		
    				let $datepicker = $( '#acf-field_5b16a9d5df47c + .hasDatepicker' );
    				
    				$datepicker.datepicker( 'option', {
    					altFormat: 'dd. M yy'
    				} );
    				
    			} );
    
    		</script>
    
    	<?php
    
    }
    add_action( 'admin_footer', 'theme_prefix_admin_footer' );
Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘Date-Formatting using 2 Dates’ is closed to new replies.