In comp.lang.java.programmer message <9_SdnRn_LruYz9fXnZ2dnUVZ8sidnZ2d@b
t.com>, Tue, 30 Jun 2009 18:57:25, RedGrittyBrick
You don't?
By TimeZone you obviously mean java.util.TimeZone which, according to
the API, "represents a time zone offset, and also figures out daylight
savings."
In the general case I suspect you can't get a DST-aware TimeZone from
an offset alone. Consider that Dakar, Casablanca, London, Lisbon,
Reykjavík and Tenerife have the same offset but probably have different
policies for DST.
They do not have the same offset, it being Northern Summer. And, of
those who do vary their clocks, London does not use "DST" but uses
"Summer Time", and I expect Lisbon does similarly in Portuguese and
Tenerife in Spanish.
Morocco, when last I checked, had unique Time Rules; Iceland is
permanently GMT; Tenerife is Spanish and its clocks always agree with
Lisbon and London.
One can only get a Time Zone from an Offset if the time is known to be
in Winter for that location. If the time is known to be in Summer
there, one also needs to know whether or not the location is LHI.
If one can get a time in January and a time in July, with different
offsets, one can deduce the Hemisphere (N/S) and the Zone - except, in
principle, for any who do not set their clocks forward from Standard
Time in Summer but instead set them back from Standard Time in Winter
(which, after all, is normally shorter). It was thought that the Irish
did that 1972; but they are not nowadays allowed to do so.
I have demonstration code for that, in javaSCRIPT, on my site.