The following piece of code:
TimeZone.getTimeZone("Europe/Athens").inDaylightTime(new Date(200, 8, 14));
returns true
, much like it does for the year 2011. However, Daylight Saving Time (DST) was only proposed 100 years or so ago, and applied even more recently. Is the time in the year 200 considered DST, or is this a Java quirk?
It depends on the timezone database. Some locales come with ridiculously detailed time instructions (such as recording 8-minute changes in UTC offsets back in the 1800s), whereas others are content with being useful for times reasonably close to the date they are created -- perhaps because the compiler of the database did not have easy access to information about when the current scheme was instituted and what came before it, and therefore coded it as "applies to all times before such-and-such".
For fun I tried this in Joda-Time 2.3 with Java 7. Looks like it works correctly.
Dump to console…
When run…
You are mistaken. It works as expected when you use the date
new Date(-1700, 8, 14)
(which is year200
). The constructor you are using is adding1900
to your year. You are actually using year2100
.Check the Date constructor api.
The date you are testing is
Not in past, but in future! To print exact date, try with
DateFormat.getDateTimeInstance( DateFormat.MEDIUM, DateFormat.SHORT).format(new Date(200, 8, 14))