start_time and end_time Issue

ads
api

#1

Hi,

I have an account in America/Los_Angeles timezone and I’m retrieving Day level data from the API. I’m planning to run the code o retrieve data every week for the last 7 days. So the start_time and end_time must be assigned dynamically.
But the problem is that the code seems to work fine when the dates are assigned manually but when done using Python code,it throws the following error.

In one particular instance. when the start_time = ‘2015-09-01T07:00:00Z’ and end_time = ‘2016-02-20T07:00:00Z’, it worked fine but with start_time=‘2016-01-28T07:00:00Z’ and end_time = ‘2016-02-04T07:00:00Z’, it throws the above error.

Thanks


Stats start_time and end_time
#2

Hi @TheNightBefore! You need to take into account the DST. The time interval that throws the error should be start_time=‘2016-01-28T08:00:00Z’ and end_time = ‘2016-02-04T08:00:00Z’, because now, Los Angeles is in UTC-8 as opposed to UTC-7 which was at the beginning of the first time interval (on 2015-09-01).

http://www.timeanddate.com/worldclock/usa/los-angeles


#3

Thanks again @majoritasdev :+1:


#4

You’re welcome, @TheNightBefore! :slightly_smiling:


#5