WordPress.org

Support

Support » Plugins and Hacks » [Resolved] Verve Meta Boxes Date Format

[Resolved] Verve Meta Boxes Date Format

  • 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?

Viewing 2 replies - 1 through 2 (of 2 total)
  • avenueverve
    Member

    @avenueverve

    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))?>

    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.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Resolved] Verve Meta Boxes Date Format’ is closed to new replies.