English 中文(简体)
为Facebook进行的“时间较少的事件”移徙
原标题:"Timezone less events" migration for Facebook

最近在Facebook上增加了时间较少的事件(https://developers.facebook.com/roadmap/#timezone-less-events),用于其开发路线图,其中说:

“由于这种移徙最初是创造的,我们增加了一个时间区领域,以表明预期会发生这种事件的时间区的名称(此处界定)。 FYI,即ISO 8601中的开发商阅读时间,在阅读活动时应当支持整个标准。 大部分活动都回过了当地时间(没有全球监测方案抵消),但今后的活动可能还回其他形式(即:仅日期和准确)。

It works for dates in ISO 8601 format but if I get dates in epoch format I always get +7 hrs difference.

e.g.

https://graph.facebook.com/369000383135224 回返

{
  "id": "369000383135224",
  "owner": {
    "name": "Horst Uwe Peter",
    "id": "1117563687"
  },
  "name": "Event in Dublin time 10:25",
  "start_time": "2012-05-04T10:25:00",
  "end_time": "2012-05-04T11:25:00",
  "timezone": "Europe/Dublin",
  "location": "Dublin, Irel以及",
  "venue": {
    "id": "110769888951990"
  },
  "privacy": "FRIENDS",
  "updated_time": "2012-05-04T09:27:29+0000",
  "type": "event"
}

以及

http://graph.facebook.com/3690003135224?date_format=U 回返

{
  "id": "369000383135224",
  "owner": {
    "name": "Horst Uwe Peter",
    "id": "1117563687"
  },
  "name": "Event in Dublin time 10:25",
  "start_time": 1336152300, <== Fri, 04 May 2012 17:25:00 GMT
  "end_time": 1336155900, <== Fri, 04 May 2012 18:25:00 GMT 
  "timezone": "Europe/Dublin",
  "location": "Dublin, Irel以及",
  "venue": {
    "id": "110769888951990"
  },
  "privacy": "FRIENDS",
  "updated_time": 1336123649,
  "type": "event"
}

以及 with FQL using GRAPH end point

页: 1 WHERE eid = 369000383135224

{
  "data": [
    {
      "eid": 369000383135224,
      "name": "Event in Dublin time 10:25",
      "description": "",
      "location": "Dublin, Irel以及",
      "venue": {
        "id": 110769888951990
      },
      "start_time": 1336152300, <== Fri, 04 May 2012 18:25:00 GMT
      "end_time": 1336155900, <== Fri, 04 May 2012 18:25:00 GMT
      "update_time": 1336123649,
      "creator": 1117563687,
      "privacy": "FRIENDS"
    }
  ]
}

does that mean migration works only for ISO 8601 formatted dates? 以及 has no affect on FQL or epoch date format?

问题回答

我在我管理的一页上发生的事件从未恢复过。

我发现的是,在前方方方言中进入的事件时间在“America/Los_Angeles”中被作为当地时间处理(与美国日光储蓄时间的变化相吻合,因此你在冬天看到+6,在夏天看到+7),然后被转换为“UTC”,储存在数据库中。

For display I use the following php function to show the correct times and note on the page that the times are local to the event s location:

function fb_event_time_convert($fb_time) {
$origin_dtz = new DateTimeZone( UTC );
$remote_dtz = new DateTimeZone( America/Los_Angeles );
$fb_time_str =  @  . $fb_time;
$origin_dt = new DateTime($fb_time_str, $origin_dtz);
$remote_dt = new DateTime($fb_time_str, $remote_dtz);
$offset = $origin_dtz->getOffset($origin_dt) - $remote_dtz->getOffset($remote_dt);
return $fb_time - $offset;
}




相关问题
Copy data from Access to SQL

I am in the process of migrating an existing Access database to a SQL database with a web front-end. I have successfully copied the database to SQL using the SQL Server Migration tool and am working ...

MongoMapper and migrations

I m building a Rails application using MongoDB as the back-end and MongoMapper as the ORM tool. Suppose in version 1, I define the following model: class SomeModel include MongoMapper::Document ...

Switching to WPF. Is it time?

I m considering switching from MFC to WPF. My first concern is that there are too many users who don t have .NET with WPF installed yet. Can anybody point to a source containing the WPF penetration ...

rake db:migrate running all migrations correctly

I m fairly new to Ruby on Rails here. I have 2 migrate files that were provided. The first one, prefixed with 001, creates a table and some columns for that table. The next migrate file, prefixed ...

Migrate Java Applet to what/where?

I am reviewing currently a medium size code base (around 30K LOC) which uses a huge Applet and interfaces with other systems. It s a tool to create custom labels, so we need drag-n-drop and other ...

热门标签