Thursday, November 17, 2016

Joda-Time DateTimeFormat

import org.joda.time.DateTime;
import org.joda.time.format.DateTimeFormat;
import org.joda.time.format.DateTimeFormatter;

DateTimeFormatter formatter = DateTimeFormat.forPattern("dd/MM/yyyy HH:mm:ss");
DateTime showDate = formatter.parseDateTime("02/02/2016 08:02:00");

facebook4j Events

import facebook4j.Event;
import facebook4j.Facebook;
import facebook4j.FacebookException;
import facebook4j.FacebookFactory;
import facebook4j.ResponseList;
import facebook4j.auth.AccessToken;

Facebook facebook = new FacebookFactory().getInstance();
facebook.setOAuthAppId(appId, appSecret);
facebook.setOAuthPermissions(commaSeparetedPermissions);
facebook.setOAuthAccessToken(new AccessToken(accessToken, null));

ResponseList<Event> events;
int count;
try {
events = facebook.getEvents();
count = events.size();
} catch (FacebookException e) {
e.printStackTrace();
}