Skip to main content

Error “Illegal datetime format” when tying to parse Facebook Insights.

Please note these java.net forums are being decommissioned and use the new and improved forums at https://community.oracle.com/community/java.
No replies
roise_r
Offline
Joined: 2011-07-05

Trying to use OData4j to get Facebook Insights data for my page using the following code:

ODataConsumer consumer;
oentitykey = OEntityKey.parse("blahblah");
String URI = "http://facebook-insights.cloudapp.net/Insights/blah-
blahbl";
consumer = ODataConsumer.create(URI);
for (OEntity app : consumer.getEntities("PageMetrics")) {
System.out.println(app);
}

I get the following exception: Exception in thread "main" java.lang.RuntimeException: java.lang.IllegalArgumentException: bad keyString: datetime'2011-05-31T00%3A00%3A00' Caused by: java.lang.IllegalArgumentException: Illegal datetime format 2011-05-31T00%3A00%3A00

this is the line in the raw data that I think it is trying to parse: "end_time": "2011-05-31T07:00:00+0000"

When I use PowerPivot for Excel to display the data, it displays it fine.