I’m having trouble getting event start in end times in UTC format from facebook.
I’m using the Facebook Python library, I am running these queries to retrieve events:
fb_events = graph.get_connections(fb_user["id"], "events", args=["date_format=U"])
for item in fb_events['data']:
curr_event = graph.get_object(item['id'], args=["date_format=U"])
The last line of the code is where I actually get the event containing the start and end times. The arg: "date_format=U" is supposed to specify the time format in unix time, which is already in UTC, however, this code still returns normal Facebook time stamps, in local time.
How can I get this information in UTC time, or in some sort of time that is consistent across time zones?
Thanks!
The following might help you to do the conversion:
See this link for more information: http://pytz.sourceforge.net/
Another example of the code