简体   繁体   English

Facebook图形API:事件时区,时间

[英]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. 我目前正在通过Facebook的图形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". 例如,我有以下三个事件:“早午餐”,“冠军联赛结局”和“Pfingst-Tanz”。 That's what the graph API gives back: 这就是图API返回的内容:

{
   "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: 在Facebook页面上显示:

  • Pfingst-Tanz 19:00 (07:00 pm) Pfingst-Tanz 19:00(07:00 pm)
  • Champions league finale 20:45 (8:45 pm) 冠军联赛决赛20:45(晚上8:45)
  • Brunch 10:00 (10:00 am) 早午餐10:00(上午10:00)

Which results in: 结果如下:

  • Pfingst-Tanz: Facebook page correct, API incorrect or TZ incorrect in my app Pfingst-Tanz:在我的应用中,Facebook页面正确,API不正确或TZ不正确
  • (Champions league finale: don't know, never mind) (冠军联赛决赛:不知道,没关系)
  • Brunch: Facebook page and API correct and same 早午餐:Facebook页面和API正确且相同

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. 根据我的理解,它必须是全是错误或没有错,但不仅仅是1/3或2/3事件。 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. 您的“早午餐”活动不包含时区,因此无法根据用户的本地时区进行调整,这是我假设Facebook正在进行的操作。

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). 我不能立即清楚start_timeend_time值是表示本地开始/结束时间(在给定时区内)还是UTC开始/结束时间,但这应该很容易根据数据计算出来(和文件,希望)。 I suspect it's the UTC start/end when there's a time zone specified, but the local start/end otherwise. 我怀疑这是指定时区的UTC开始/结束,否则是本地开始/结束。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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