I've created a custom profile field for my BP users and I'm looking to show the value on the user's profile page. The code below does this...

<?php bp_profile_field_data( array('user_id'=>get_the_author_meta( 'ID' ),'field'=>'birthday')); ?>

...But it displays it as "1985-10-30 00:00:00".

How can I format this to display like this: "October, 30 1985"


I have no idea if BuddyPress has built in date functions but WordPress does and PHP does. This should do it:

$bpress_date = bp_profile_field_data( array('user_id'=>get_the_author_meta( 'ID' ),'field'=>'birthday'));
// $bpress_date = "1985-10-30 00:00:00"; // test
echo date('F, j, Y',strtotime($bpress_date));

PHP's date expects UNIXTIME. That is why the date string is passed through strtotime. It does not work without that step.

You probably want to consider using WordPress' date_i18n, however, which would look like:

echo date_i18n(get_option('date_format'),strtotime($bpress_date));

This gives you some ability to internationalize things as the date will displayed according to the blog's date format settings.


You would use the PHP function date() to format the birthday timestamp.


$birthday = bp_profile_field_data( array('user_id'=>get_the_author_meta( 'ID' ),'field'=>'birthday'));
echo date('F, j Y', $birthday);
//would result in October, 30 1985


  • Thanks for the reply, this only seemed to want to return the date "Jan 1, 1970" – Red Mar 24 '13 at 0:22

Not the answer you're looking for? Browse other questions tagged or ask your own question.