将Facebook Graph API Date转换为UNIX时间戳

win*_*ter 6 php facebook

我如何将Facebook Graph API日期转换为UNIX时间戳?

fux*_*xes 16

Facebook最近添加了一个功能,其中日期/时间将以Unix时间戳格式返回,只需将date_format=U查询参数添加到Graph调用的末尾即可.例如:

https://graph.facebook.com/me/events?date_format=U&access_token=.....
Run Code Online (Sandbox Code Playgroud)

这将以Unix时间戳格式返回时间/日期(例如1309572000).

注意:截至目前,只有时间戳格式的updated_time而不是start_time


Joh*_*nde 6

我不知道日期格式,但我怀疑它是普通的和/或标准格式,所以strtotime()应该工作得很好.

$timestamp = strtotime('2012-04-24T22:01:00+0000');
Run Code Online (Sandbox Code Playgroud)