Getting the Date of Posting from the Facebook API

Asked

Viewed 48 times

0

Good morning,

I’m implementing the Facebook Api, but I need it to bring me beyond the photo and description of the publication, the date of publication(Day and Month).

Has anyone ever done or know, that can help me how? Grateful!

@@Edit

The API already brings me the date information, with created_time!

then within Facebook.js

function dateByJsonToUTC(dateCurrent){
    var postDate = new Date(dateCurrent);
    var mes = postDate.getUTCMonth() + 1;
    var utcDate =   {
      'year' : postDate.getUTCFullYear(),
      'month' : postDate.getUTCMonth(),
      'mes' : transformDateNumberInDateString( postDate.getUTCMonth() + 1),
      'day' : postDate.getUTCDate(),
      'hour' : postDate.getUTCHours(),
      'minutes' : postDate.getUTCMinutes()
    }
    return utcDate;
}

where I am setting the date information. Inside the for, to get all the posts on the page, I put: let date = dateByJsonToUTC( listPosts[i].created_time );, where I can get the information I want from the date, for example date day.

  • 1

    Is getting via /me/posts? Unless mistaken it already returns the created_time

  • Really, it already brings me the created_time, already managed to solve, thank you very much! <3

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.