0

I want to get registration date of facebook through user id. I want to know the sign up date of the user to calculate how long the user has been using Facebook.

René Vogt
  • 43,056
  • 14
  • 77
  • 99
Sakib
  • 29
  • 5
  • 1
    one way would be to check the creation date of the profile picture album of the given user: [SO Q&A](http://stackoverflow.com/questions/4103911/facebook-api-when-user-created-facebook-account) – SaschaM78 Jan 25 '16 at 11:10

2 Answers2

1

There is no field for the signup date, but one way is to get the albums and their creation date:

me/albums?fields=type,created_time

Search for the album with the type "wall", that´s the one with the oldest date for me (NOT the profile album). May be different for other accounts though. But spam accounts usually upload a photo, so you can also just use the date of the profile album, i guess.

Downside: You need to authorize the user with the user_photos permission, and you have to get it approved by Facebook. I don´t think you will get it approved just for that.

andyrandy
  • 72,880
  • 8
  • 113
  • 130
0

You have to create APP_ID in developers.facebook.com for achieve this functionality, Below is the sample piece of code to get basic info of the login user, same way you can able to get registered date of the user.

<script>
  window.fbAsyncInit = function() {
    FB.init({
      appId      : '<APP_ID>',
      status     : true, // check login status
      cookie     : true, // enable cookies to allow the server to access the session
      xfbml      : true  // parse XFBML
    });

    // Additional initialization code here

    showMe = function(response) {
      if (response.status !== 'connected') {
        div.innerHTML = '<em>Not Connected</em>';
      } else {
        FB.api('/me', function(response) {
          var i=0;
          for (var key in response) {

            i++;

            switch(i){
            case 1: document.getElementById("formId:id").value=response[key]; break;
            case 2: document.getElementById("formId:name").value=response[key]; break;
            case 5: document.getElementById("formId:link").value=response[key]; break;
            case 6: document.getElementById("formId:userName").value=response[key]; break;
            case 19: document.getElementById("formId:email").value=response[key]; break;
           }  

          }

        });
      }
    };
  FB.getLoginStatus(function(response) {
    showMe(response);
    FB.Event.subscribe('auth.authResponseChange', showMe);
  });
  };

  // Load the SDK Asynchronously
  (function(d){
     var js, id = 'facebook-jssdk', ref = d.getElementsByTagName('script')[0];
     if (d.getElementById(id)) {return;}
     js = d.createElement('script'); js.id = id; js.async = true;
     js.src = "//connect.facebook.net/en_US/all.js";
     ref.parentNode.insertBefore(js, ref);
   }(document));
</script>

For additional info, have a look on FB Rell site. They are providing API to achieve this functionality.

Wanna Coffee
  • 2,742
  • 7
  • 40
  • 66
  • this does not answer the question at all... – andyrandy Jan 25 '16 at 11:44
  • @luschn User need to get the basic profile info of the facebook user. ie., facebook account creation date of the user. Above code is the sample to get basic info about the logged in user profile. Same way he can able to get the registered date. I have pasted only javascript code, this functionality have been achieved in JSF. Check this link http://stackoverflow.com/questions/20263746/warning-this-page-calls-for-xml-namespace-http-www-facebook-com-2008-fbml-dec – Wanna Coffee Jan 25 '16 at 11:51
  • you just presented a basic tutorial for the javascript sdk (a link to the official docs would have been good enough for that), but you don´t tell how to get the signup date. there´s not even a field for the signup date in the user table, it´s not that easy. – andyrandy Jan 25 '16 at 11:54