Summer Time VS Winter Time in the same timezone


Hi all,

We’re starting to find an issue that we don’t really know how to solve at this time.

Since in our country we changed from Winter Time to Summer Time (+01:00 to +02:00)

Is any dynamic / programatic with your ADS API ( maybe with account information or something related ) to detect this date in order to parse the offset correctly?



Hi @hector_borras! You can get the account’s timezone, and using the timezone you can know what the offset currently is.


Hi @majoritasdev thanks for your help. But I still don’t know how to achieve this, I mean:

If I have this account:

            "approval_status": "ACCEPTED",
            "created_at": "2015-08-19T12:21:32Z",
            "deleted": false,
            "id": "18ce541irm3",
            "name": "NAME",
            "salt": "SALT",
            "timezone": "Europe/Madrid",
            "timezone_switch_at": "2015-09-26T22:00:00Z",
            "updated_at": "2016-04-15T04:44:21Z"

I can extract that the current offset is +02:00 due to “timezone_switch_at” shows me 22:00:00

But the thing is, How can I know the offset before the Winter vs Summer time change.

Last 27th of March spain changed the offset from +01:00(Winter Time) to +02:00 (Sumer Time) If I want to retrieve statistics from that lapse of time, I don’t know how to detect the previous offset



Well, you can use the PHP functions date_offset_get and date_create (or their equivalent in your programming language). For example, to find out the UTC offset, in hours, for a given time from a given timezone, I do:

$timeUtcOffsetHours = date_offset_get(date_create($dateTimeInGivenTimezone . ' ' . $theTimezone)) / 3600;

Please also see v1 stats end_time cannot be in the future



Thanks a lot!

I’ll try this. I didn’t know that function exists, I use PHP too.

Thank you so much!


:slight_smile: you’re welcome!