In java.util.Date
:
* In all methods of class Date
that accept or return
* year, month, date, hours, minutes, and seco
java.util.Date is no date at all. It is (quoting http://docs.oracle.com/javase/6/docs/api/java/util/Date.html) specific instant in time, with millisecond precision.
It has no relationship with any particular date, hour, etc. You may extract day, year, etc from it- using given calendar and timezone. Diffrent calendars, timezones will give diffrent dates.
If you are ever interested in storing date (day, month, year) do not use java.util.Date
Instead
Basically the original java.util.Date designers copied a lot from C. What you're seeing is the result of that - see the tm struct. So you should probably ask why that was designed to use the year 1900. I suspect the fundamental answer is "because we weren't very good at API design back when tm
was designed." I'd contend that we're still not very good at API design when it comes to dates and times, because there are so many different use cases.
This is just the API though, not the storage format inside java.util.Date
. No less annoying, mind you.