Take the 2-minute tour ×

While doing some research on timezones I found this interesting post on the GeoNames forum:

rawOffset gives the fixed timezone.
dstOffset gives the civil time offset from GMT on July 1st
gmtOffset gives the civil time offset from GMT on January 1st

On the southern hemisphere, for example for Chile (http://ws.geonames.org/timezone?lat=-33.46912&lng=-70.641997) we have the following values:

rawOffset = -4 indicating the timezone
dstOffset = -4
gmtOffset = -3, which means that daylight saving time is in use in January.

On the northern hemisphere, for the Netherlands for example (http://ws.geonames.org/timezone?lat=51.589322&lng=4.774491):

rawOffset = 1
dstOffset = 2
gmtOffset = 1, indacting that daylight saving time is in use in July.

This is not the first time I saw rawOffset either, this SO answer (in Java) also relies on it.

My objective is to use the raw offset to build a timezone drop-drop menu showing the UTC offsets for each group of cities, right now I'm listing all the transitions for the timezone and using the non-DST offset, but the post I mentioned above suggests that it's wrong for the southern hemisphere.

EDIT: http://download.oracle.com/javase/1.4.2/docs/api/java/util/TimeZone.html#getRawOffset%28%29

Marc from GeoNames told me that they get the raw offset by using that Java method.

Any Java wizard knows how they do it? Or where I can browse their source-code of getRawOffset()?

Any ideas on how I can get the raw offset in PHP?

share|improve this question
Do you have any other name for "raw offset"? –  hakre Oct 19 '11 at 14:47
What do you have to work with? It's not clear at all from that other question. –  Jon Oct 19 '11 at 14:48
not sure what the question is either but maybe php.net/manual/en/datetimezone.gettransitions.php can give you what you are looking for somehow. –  Gordon Oct 19 '11 at 14:56
@Gordon: I'm already using DateTimeZone::getTransitions(), but it only returns a field with the offset and another boolean field (isdst), I don't think I can figure out the raw offset from there. –  Alix Axel Oct 19 '11 at 15:15
@hakre: I don't think so, I know of the standard offset (aka the offset from UTC while not on DST), the DST offset and the raw offset... –  Alix Axel Oct 19 '11 at 15:18
show 1 more comment

1 Answer

It's not clear why you need the raw offset.

In PHP, given a time + location, you can instantiate a DateTime object and then call its getOffset() method to calculate the current timezone offset. Iterating over different locations, this should be all you need to get your drop down menu, no?

See http://www.php.net/manual/en/datetime.getoffset.php

share|improve this answer
add comment

Your Answer


