Convert Google Date graph frame to UNIX timestamp

How can I convert a Facebook Graph Graph API date to a UNIX timestamp?

+6
source share
2 answers

I do not know the date format, but I suspect that it is in a common and / or standard format, so strtotime() should work fine.

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

Facebook recently added a function in which the date / time will be returned in Unix timestamp format, just add the date_format=U request parameter to the end of your Graph call. For instance:

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

This will return the time / dates in a Unix timestamp format (e.g. 1309572000).

Note. At the moment, only updated_time in timestamp format, but not start_time

+16
source

Source: https://habr.com/ru/post/914737/


All Articles