stUrb
stUrb

Reputation: 6842

Filter facebook events on date in FQL

I'm using a fairly simple FQL-query to query all the events by a page.

SELECT 
   eid, name, pic_big, start_time, end_time, location, description 
   , creator, host, venue
FROM 
   event
WHERE 
   eid IN ( SELECT eid FROM event_member WHERE uid = {$uid} ) 
ORDER BY start_time asc

In the time facebook stored it's start_time and end_time in timestamps it was simple to get only future events: ... AND end_time >= {$now} ...

But facebook changed it's fields in timezone format. Is there an easy way, preferably in fql, to only show the future events?

Upvotes: 1

Views: 1332

Answers (1)

Forrest Bice
Forrest Bice

Reputation: 602

Unless I'm misunderstanding your problem, I just tried this out on the Facebook Graph API & FQL Explorer and it appeared to work.

The only changes I made to your query was to replace {$uid}and {$now} with me() and now() respectively. The following query returned only future events for my account:

SELECT eid, name, pic_big, start_time, end_time, location, description, creator, host, venue
FROM event
WHERE eid
IN (SELECT eid FROM event_member WHERE uid = me())
AND start_time >= now()

You can view this in action at: Facebook Graph API Explorer Example And of course be sure you provide the Explorer with a valid access token for your account.

Upvotes: 1

Related Questions