When you look at the javadoc of the java.util.Date class, most of the methods are deprecated. Why was this done?
5 Answers
Well, for two related reasons. It was a very poor implementation of the concept of Dates and Times and it was replaced by the Calendar
class.
The Calendar
class, although an improvement, leaves a lot to be desired as well, so for serious Date/Time work, everyone recommends Joda-Time. Java 8 brings the new java.time.* package, inspired by Joda-Time, defined by JSR-310, and intended to supplant the old Date/Calendar classes.
Edit: In response to the specific question of why the implementation is poor, there are many reasons. The JavaDoc sums it up as follows:
Unfortunately, the API for these functions was not amenable to internationalization.
In addition to this general deficiency (which covers issues like the lack of a Time Zone component as well as the date formatting which is better handled in DateFormat
and the inability to have a non-Gregorian calendar representation), there are specific issues which really hurt the Date
class, including the fact that year is presented in an offset of 1900 from Common Era year.
Calendar
has its own problems, but even as early as JDK 1.1 it was obvious that java.util.Date
was not going to cut it. Even though Calendar
is arguable the worst JDK API, it has taken until version 7 to attempt to address it.

- 303,325
- 100
- 852
- 1,154

- 90,445
- 31
- 189
- 263
-
9Cleanly making the transition from inadequate to incomprehensible in jdk 1.1 :) – clstrfsck May 25 '10 at 00:36
-
Also the 'Date' class was named poorly. They should have called it a Time, or DateTime. – Alex R Nov 23 '16 at 19:40
Date
is mutableDate
doesn't have support for time zones
The latter led to it being replaced by Calendar
. And the former, combined with the ease-of-use, lead to both being replaced by Joda-Time / JSR-310 (java.time.* package)

- 303,325
- 100
- 852
- 1,154

- 588,226
- 146
- 1,060
- 1,140
-
8Thank you IBM for Calendar, DateFormatter and all the other associated crap. Another brilliant example of overengineering without actually solving the problem at hand. – mP. May 25 '10 at 13:03
They're deprecated because Date was written as fast as possible back in the day when they wanted to rush the JDK out the door.
It turns out the Dates and Calendars are Hard. So, they created the Calendar class, which much more thought, in order to handle the Hard Parts of working with calendars.
They deprecated the Date methods and delegated to Calendar because they didn't want to change the behavior of the existing Date methods, and possibly break existing applications.

- 115,893
- 19
- 128
- 203
Here's a good answer straight from Oracle: http://www.oracle.com/technetwork/articles/java/jf14-date-time-2125367.html
A long-standing bugbear of Java developers has been the inadequate support for the date and time use cases of ordinary developers.
For example, the existing classes (such as
java.util.Date
andSimpleDateFormatter
) aren’t thread-safe, leading to potential concurrency issues for users—not something the average developer would expect to deal with when writing date-handling code.Some of the date and time classes also exhibit quite poor API design. For example, years in
java.util.Date
start at 1900, months start at 1, and days start at 0—not very intuitive....
java.util.Date
represents an instant on the timeline—a wrapper around the number of milli-seconds since the UNIX epoch—but if you call toString(), the result suggests that it has a time zone, causing confusion among developers.

- 1
- 1

- 62,768
- 50
- 234
- 356
-
It seems the author didn't bother to proofread his article. As of Java's [java.util.Date](http://docs.oracle.com/javase/7/docs/api/java/util/Date.html) online documentation, days start at `1` and months start at `0`. Both correspond with the UNIX API, see [time.h](http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/time.h.html). – Olaf Dietsche Nov 06 '15 at 13:04
I don't know the official reason why it has been deprecated, but as far as I can tell GregorianCalendar
and Joda-Time support operations on dates, meaning that you can add, for instance, a day to a date and have its month and year updated accordingly.
For instance, say you want to compute the day after the current date and today is May 31st; with java.util.Date
, you just have getDays() +1
, which returns 32, and you have to handle the knowledge that the current month doesn't have 32 days by yourself; with GregorianCalendar
or Joda.time, adding a day to May 31st results in an object representing June 1st, hiding the complexity from your sight.

- 303,325
- 100
- 852
- 1,154

- 9,280
- 10
- 44
- 65
-
2Your example is not a problem with the Date object, but with the code using it. GregorianCalendar would do the exact same thing. So that entire point is moot. – Supericy May 30 '13 at 08:36