2012-01-16 6 views
2

私のタイムゾーンはEurope/Romeです。 I APIのとinsights部分はPacific Daylight Timeに対してパラメータend_timeを受け付けるFacebookのPHP SDKを使用しています:Facebook PHP SDKを呼び出すときのDateTimeとタイムゾーン?

メトリックが収集された期間の終わりに、 は、UNIX時間として表さ(れるべき常に深夜です。太平洋 夏時間)。

質問は公正単純です:私は私の時間帯の正しい統計情報を得るためにgetTimeStamp()を呼び出す前に、PDT(および方法)に$endを変換する必要がありますか?

// Get stats with 1st January 2012 as end_time (relative to my time zone) 
$page = Facebook->getUser()->getPage($id); 
$stats = $page->getData('page_views_unique', new DateTime('2012-01-01')); 

public function getData($metric, DateTime $end = null) 
{ 
    $now = new DateTime(); 
    $end = is_null($end) || $end > $now ? $now : $end; // Default is $now 

    // API call 
    $args = array('end_time' => $end->getTimestamp()); 
    $this->sdk->api(sprintf('/%s/insight/%s', $this->id, $metric), 'GET', $args); 
} 

答えて

関連する問題