• I’m using:

    $has_my_meta = get_post_meta( $post->ID, 'StartDate,EndDate',true );
    if( $has_my_meta )
    $with_meta[] = $post->ID?>

    To grab event start and end dates that are stored as custom fields, and then outputting the date with echo get_post_meta, but I’m not having a lot of luck formatting the date output. Dates are stored as YYYY-MM-DD. I’d like the dates to display as n/j/Y or even as M/j/Y. What am I missing?

    Thanks in advance

Viewing 2 replies - 1 through 2 (of 2 total)
  • Did you ever get an answer to this question, because I have it too.

    In your example, get_post_meta will only accept a single Custom Field name. Try something like this:

    $start_date = get_post_meta( $post->ID, 'StartDate', true);
    $new_format_start = date('M/j/Y',strtotime($start_date));
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Formatting date in echo get_post_meta’ is closed to new replies.