This request will capture the list of all friends in the registered user account:
SELECT uid, name, birthday_date FROM user WHERE uid IN (SELECT uid2 FROM friend WHERE uid1=me()) ORDER BY birthday_date ASC
Trap of this - you will need to check if the user has entered his birthday in his Facebook accounts.
Best query (at least I think is better):
SELECT uid, name, birthday_date FROM user WHERE uid IN (SELECT uid2 FROM friend WHERE uid1=me()) AND birthday_date >= '02/01' AND birthday_date <= '07/01' ORDER BY birthday_date ASC
This list only receives a list of users who have filled in their birthday on their Facebook accounts. And with ORDER BY birthday_date they will always be with the upcoming birthday at the top, right up to the last in the result set.
Trap this, and feel free to test it, I never got whole years on my birthday using the second query. SO in my application, I call after 6 months of data at a time. It has always been accurate and pretty much hack.
I suspect that the second request will meet your goal, given that you need to show your upcoming birthday at the top of the list. To always get the current date and month to get the exact result, use this example (and a simple Google search or a SO search will give you more) to get the current date and month:
http://www.asbhtechsolutions.com/android-tutorials/android-get-current-date-and-time
Then concatenate a String and pass this instance as a request.
NOTE. . The month and date used in the request must be double digits at all times .
source share