wintercounter
wintercounter

Reputation: 7468

Convert Facebook Graph API Date to UNIX timestamp

How might I convert a Facebook Graph API Date to a UNIX timestamp?

Upvotes: 6

Views: 10485

Answers (2)

fuxes
fuxes

Reputation: 418

Facebook recently added a feature where date/times will be returned in Unix timestamp format, simply add the date_format=U query parameter to end of your Graph call. For example:

https://graph.facebook.com/me/events?date_format=U&access_token=.....

This will return time/dates in Unix timestamp format (such as 1309572000).

Note: As of now only the updated_time in timestamp format but not the start_time

Upvotes: 16

John Conde
John Conde

Reputation: 219794

I don't know the date format but I suspect it is in a common and/or standard format so strtotime() should work just fine.

$timestamp = strtotime('2012-04-24T22:01:00+0000');

Upvotes: 6

Related Questions