WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Verve Meta Boxes Date Format (3 posts)

  1. Burke Ingraffia
    Member
    Posted 3 years ago #

    I am using a date/time custom field created by Verve Meta Boxes and the output works when I add this to my template:

    $airtime_begin = get_post_meta($post->ID, 'airtime_begin', true);

    Then I use the code

    echo '$airtime_begin'

    and the date comes out: 2010-07-05 00:00:00

    But when I try to change the format with

    echo 'date("M j,y", $airtime_begin)' all I get is Jan 1, 1970, not the desired Jul 5, 2010.

    What am I doing wrong?

  2. avenueverve
    Member
    Posted 3 years ago #

    you need to do strtotime($airtime_begin) because the date function takes a timestamp as an argument. So this will work:

    <?php echo date("M j, y",strtotime($airtime_begin))?>

  3. Burke Ingraffia
    Member
    Posted 3 years ago #

    Beautiful! Can I just say how much I love the WordPress community!!!

    I'm going to the WordCamp in Birmingham, AL next month. I hope I can do my part to contribute.

Topic Closed

This topic has been closed to new replies.

About this Topic