I’m creating an event with the Facebook PHP SDK like this
$fb_event['name'] = $_POST['post_title'];
$fb_event['description'] = $_POST['content'];
$fb_event['start_time'] = date( "c", Ai1ec_Facebook_Event::get_facebook_start_time($event->start));
$fb_event['location'] = "Dove ti pare basta che si aggiorni al mio timezone";
$fb_event['street'] = "Via andrea del sarto 9";
$fb_event['city'] = "Milan";
$facebook = $this->facebook_instance_factory();
try {
$result = $facebook->api( "/me/events", "POST", $fb_event );
} catch (FacebookApiException $e) {
fb($e);
}
the Ai1ec_Facebook_Event::get_facebook_start_time simply takes a timestamp and transforms it to UTC pretending that it’s PST. This means that if i edecide that the EVENT starts at 8PM UTC that function returns me 3AM of the following day.
Evrything works correctly and my event is created and the problem is that if i look at the event with my user which is in TIMEZONE UTC + 2 i still se 8PM and not 10PM
This is the created event https://www.facebook.com/events/245655182207213/
It seems like Facebook it’s ignoring timezones when creating this event, why?What do i have to tell facebook so that it uses standard timezones?
EDIT – After reading this article developers.facebook.com/roadmap/#timezone-less-events i realized that there is timezone field, but i can’t get that to work, because if i send
$fb_event['timezone'] = "Europe/Sofia";
Facebook simply ignores that and when i query the events i get back NULL fo rthe timezone.
Facebook has implemented “timezoneless events.” What I have found this to mean is that events are always displayed to a user as though they are in that user’s local time (So when I visit your event page on Facebook, I also see your event as taking place at 20:00-22:00, even though I am located at UTC-4).
The Events API documentation say that start_time and end_time should be passed a “string containing an ISO-8601 formatted date/time or a UNIX timestamp”.
I recommend passing it the ISO-8601 formatted date, because if you pass it a timestamp, you need to correct that timestamp for daylight savings time (both yours and Facebook’s). So for your event, your code should just look like
$fb_event['start_time'] = date( "c", $event->start);