Riyaz saifi Riyaz saifi - 4 months ago 25
PHP Question

How To Get user birthday Info graph api

I want get user DOB info using Facebook graph API. I got full dob but i need only Day and month

$graph_url ="https://graph.facebook.com/me?fields=id,first_name,name,gender,location,birthday&access_token=" . $accessToken;
$user = json_decode(get_html($graph_url));

echo $user->birthday


The output is
MM/DD/YYYY
any way to get only Month and days.
Thanks.

Answer

As you said that you want number like 8/5 from your birthday that is coming. So you have to do simply:-

echo date('m/d',strtotime( $user->birthday));

To check date formats:-

http://php.net/manual/en/function.date.php