Why so many methods deprecated in java.util.Date.

Discussion in 'Java' started by nhsoft.xy@gmail.com, Apr 16, 2006.

  1. Guest

    eg.
    /**
    * Returns the day of the month represented by this <tt>Date</tt>
    object.
    * The value returned is between <code>1</code> and <code>31</code>

    * representing the day of the month that contains or begins with
    the
    * instant in time represented by this <tt>Date</tt> object, as
    * interpreted in the local time zone.
    *
    * @return the day of the month represented by this date.
    * @see java.util.Calendar
    * @deprecated As of JDK version 1.1,
    * replaced by <code>Calendar.get(Calendar.DAY_OF_MONTH)</code>.
    * @deprecated
    */
    @Deprecated
    public int getDate() {
    return normalize().getDayOfMonth();
    }

    Why, I think Calendar.get(Calendar.DAY_OF_MONTH) is more ugly then
    Date.getDate()
    , Apr 16, 2006
    #1
    1. Advertising

  2. Bjorn Abelli Guest

    <> wrote...

    > Why, I think Calendar.get(Calendar.DAY_OF_MONTH) is more ugly
    > then Date.getDate()


    You'll find one explanation in the JDK:

    "The class Date represents a specific instant in time,
    with millisecond precision.

    Prior to JDK 1.1, the class Date had two additional functions.
    /.../ Unfortunately, the API for these functions was not amenable
    to internationalization. /.../"

    http://java.sun.com/j2se/1.5.0/docs/api/java/util/Date.html

    So, instead of trying to "fix" the Date-class, they provided the new
    Calendar-classes, and deprecated the corresponding methods in Date.

    The Date class is now to be considered only as a Holder for that millisecond
    in time, which in different TimeZones mean different local times.

    As such it's still useful as e.g. the superclass of java.sql.Date,
    java.sql.Time, java.sql.Timestamp.


    // Bjorn A
    Bjorn Abelli, Apr 16, 2006
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    5
    Views:
    98,597
    vongeuca
    May 4, 2011
  2. Mr. SweatyFinger
    Replies:
    2
    Views:
    1,842
    Smokey Grindel
    Dec 2, 2006
  3. BoBi
    Replies:
    3
    Views:
    4,187
  4. Replies:
    5
    Views:
    5,595
  5. grz01
    Replies:
    3
    Views:
    2,338
    Arne Vajhøj
    Sep 18, 2009
Loading...

Share This Page