facebook-graph-api – 查询Ads API统计信息需要开始/结束时间吗? (如何调整夏令时)

我正在尝试为帐户查询广告组统计信息API,以获取一整天的数据.

The Facebook documentation recommendation将指定开始和结束日期以及与ad_account时区相关的时间(以UTC为单位),如以下示例所示:

1)太平洋时间(12/8/2012):

/adgroupstats?start_time=2012-12-08T08:00:00&end_time=2012-12-09T08:00:00&
stats_mode=with_delivery&include_deleted=true&access_token=

2)夏令时(2012年8月8日):

/adgroupstats?start_time=2012-08-08T07:00:00&end_time=2012-08-09T07:00:00
&stats_mode=with_delivery&include_deleted=true&access_token=

我正在寻找一种更好的方法来解释夏令时,所以我想知道是否完全排除时间是一种选择,因为我只是在一整天之后.

在测试中,我发现以下内容返回与选项2相同的结果,但我想知道这是否是一个可靠的方法,因为它没有文档:

/adgroupstats?start_time=2012-08-08T00:00:00&end_time=2012-08-09T00:00:00&
stats_mode=with_delivery&include_deleted=true&access_token=

最佳答案 你必须提供开始和结束时间.否则就没有办法知道你想要哪一天的统计数据.

请参阅Stats Documentation的“查询唯一统计信息”.

我引用“注意:由于时间以UTC表示,您必须手动调整请求中的夏令时”

因此,解决方案应该是如何对您的请求进行编程以使DST调整开始/结束时间.

如果您使用的是PHP,请参阅:
How can I detect day light savings automatically in PHP?

要么:
PHP daylight saving time detection

点赞