简体   繁体   中英

Facebook graph API: Event timezone, time

I am currently having a problem with getting the correct time for an event via Facebook's graph API. There are some events showing the correct time and some are not. Even if I am calculating the timezone wrongly, it just doesn't make sense to me.

For example I have the following three events: "Brunch", "Champions league finale" and "Pfingst-Tanz". That's what the graph API gives back:

{
   "data": [
      {
         "name": "Pfingst-Tanz",
         "start_time": "2012-05-27T10:00:00",
         "end_time": "2012-05-27T14:00:00",
         "timezone": "Europe/Berlin",
         "location": "...",
         "id": "..."
      },
      {
         "name": "Championsleague Finale",
         "start_time": "2012-05-19T11:45:00",
         "end_time": "2012-05-19T14:45:00",
         "timezone": "Europe/Berlin",
         "location": "...",
         "id": "..."
      },
      {
         "name": "Muttertagsbrunch",
         "start_time": "2012-05-13T10:00:00",
         "end_time": "2012-05-13T14:00:00",
         "location": "...",
         "id": "..."
      }
   ],
   "paging": { … }
}

On the Facebook page it shows:

  • Pfingst-Tanz 19:00 (07:00 pm)
  • Champions league finale 20:45 (8:45 pm)
  • Brunch 10:00 (10:00 am)

Which results in:

  • Pfingst-Tanz: Facebook page correct, API incorrect or TZ incorrect in my app
  • (Champions league finale: don't know, never mind)
  • Brunch: Facebook page and API correct and same

This just does not correspond to each other. From what I understand it has to be either all wrong or none wrong, but not just 1/3 or 2/3 events. Does anyone have an idea, or am I just too blind to see something?

Your "Brunch" event doesn't include a time zone, so it can't be adjusted to the user's local time zone, which is what I assume Facebook is doing.

It's not immediately clear to me whether the start_time and end_time values are meant to represent the local start/end times (in the given time zone) or the UTC start/end times, but that should be easy enough to work out based on the data (and documentation, hopefully). I suspect it's the UTC start/end when there's a time zone specified, but the local start/end otherwise.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM