0

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?

4

1 に答える 1

2

あなたの「ブランチ」イベントにはタイムゾーンが含まれていないため、ユーザーのローカルタイムゾーンに合わせて調整することはできません。これは、Facebookが行っていることだと思います.

start_timeとのend_time値がローカルの開始/終了時刻 (指定されたタイム ゾーン) を表すのか、UTC の開始/終了時刻を表すのかはすぐにはわかりませんが、データ (およびドキュメンテーション、うまくいけば)。タイムゾーンが指定されている場合はUTCの開始/終了であると思われますが、それ以外の場合はローカルの開始/終了です。

于 2012-05-22T15:59:01.847 に答える