Support » Plugins and Hacks » Verve Meta Boxes Date Format
6 years, 9 months 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
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?
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.