Timezone issue


{“errors”:[{“code”:“INVALID_TIME_WINDOW”,“message”:“Expect time to be midnight in the account’s local timezone for day granularity”,“parameter”:""}],“request”:{“params”:{“start_time”:“2016-12-02T18:00:00Z”,“entity_ids”:[“6ngar”],“end_time”:“2016-12-31T19:00:00Z”,“placement”:“PUBLISHER_NETWORK”,“account_id”:“18ce548hnmt”,“granularity”:“DAY”,“entity”:“CAMPAIGN”,“metric_groups”:[“ENGAGEMENT”,“WEB_CONVERSION”,“BILLING”,“MEDIA”,“VIDEO”,“MOBILE_CONVERSION”]}}}

got this error,
when trying to get campaign statistic using day level granularity.


Had similar issues. There’s an older topic about this found here: TIME_INVALID_WINDOW for correct start date?

The workaround for me was to use ‘hourly’ granularity and then aggregate it daily if daily is required.


@BSDarandale1111 and @JonathonOgden: Please take a closer look at the error message:

"Expect time to be midnight in the account's local timezone for day granularity"

The topic you linked to states the same:

When using the /stats/ endpoints with granularity of DAY or TOTAL, the start_time value must be specified at midnight of the desired day in the local timezone of the account holder.

@BSDarandale1111: You’ve specified a start time of 18:00:00 and an end time of 19:00:00. What is the actual offset you’ll need to use to specify midnight in your account’s timezone?


Thank you @juanshishido


Thanks Juan. Mine was a similar but not identical issue. After more digging, I found that although I was accounting for midnight in my timezone, the component my query was passing through (it’s part of an ETL package) was encoding the date/time incorrectly which in turn threw this error.


Thanks for the clarification, @JonathonOgden!