List of all Upcoming Facebook Friends Birthdays in

2019-08-22 02:39发布

问题:

How to get Facebook Friends Birthdays in order of upcoming like: show top on list those birthdays are coming next by using current date and so on.

still i am getting birthdays in form of January to December, Getting Friends on Top those birthdays in January and on bottom those birthdays in December.

and i am also getting friends on top those birthdays has gone in January like birthday was on 2nd Jan or 28 Jan,

Now i just want to see list of Next Upcoming Birthdays,those passed away on bottom of the list...

Like here:

https://itunes.apple.com/in/app/birthday-sweet-birthday-calendar/id367346406?mt=8

https://play.google.com/store/apps/details?id=com.scoompa.birthdayreminder&hl=en

they have shown recents on top and later on bottom in a List...

Still i am using this query :

    String query = "select name, birthday, uid, pic_square from user where uid in (select uid2 from friend where uid1=me()) order by birthday_date";

Also Tried with this code:

 Calendar c = Calendar.getInstance(); 
    int month = c.get(Calendar.MONTH)+1;

    String query = "select name, birthday, uid, pic_square from user where uid in " +
    "(select uid2 from friend where uid1=me())AND birthday_date >= '" + month + "/01' AND birthday_date <= '" + month + "/31' ORDER BY birthday_date ASC";

回答1:

You can sort the list of friends according to their birthday. like,

SELECT uid, name, birthday_date FROM user
WHERE uid IN (SELECT uid2 FROM friend WHERE uid1=me())
AND birthday_date >= CURRENT_DATE
AND birthday_date <= LAST_DATE
ORDER BY birthday_date ASC

Here in place of CURRENT_DATE you could enter the current system date. So this will show the upcoming birthday from the current date. and in place of LAST_DATE, you could use the date upto which you want to show the upcoming birthdays.