The Support Forums will be in read-only mode for a scheduled maintenance window on 01 September 2016 14:00 UTC - 20:00 UTC. More information.

Advanced Custom Fields
Custom post Meta Date Format (2 posts)

  1. dustykhan
    Posted 2 years ago #

    I am using this code to get a custom field with a date stored withing the contact form 7 plugin, generated by the 'advanced custom fields' plugin:

    elseif ( '_post_event_date' == $name )
        		$output = get_post_meta($post->ID, 'event_date', true);

    This gets the date and displays it as "20140131" within the sent email but I need it formatted as "Friday, January 31st, 2014", but I can seem to get this to work.

    Here is what I have tried, but does not work:

    elseif ( '_post_event_date' == $name )
        		$output = get_post_meta($post->ID, 'event_date', true);
        esc_html_e( date_i18n( 'l, F jS, Y' , strtotime( $event_date ) ) );


  2. domokun
    Posted 2 years ago #

    I don't think you need the strtotime as the date is already in standard date format YYYMMDD

    Just try using
    date( 'l, F jS, Y' , $event_date )

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Advanced Custom Fields
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic